From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58141A0548; Wed, 15 Jun 2022 09:45:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EA0842836; Wed, 15 Jun 2022 09:45:44 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id A017140222 for ; Wed, 15 Jun 2022 09:45:40 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LNHQc45Q7zDrL9; Wed, 15 Jun 2022 15:45:12 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 15:45:38 +0800 From: Chengwen Feng To: , , , , , , , CC: Subject: [PATCH 1/5] usertools: use non-strict when json-loads in telemetry Date: Wed, 15 Jun 2022 15:39:11 +0800 Message-ID: <20220615073915.14041-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220615073915.14041-1-fengchengwen@huawei.com> References: <20220615073915.14041-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use 'strict=False' in json-loads, it will ignore control characters (e.g. '\n\t'), this patch is prepared for the support of telemetry dump in the future. Signed-off-by: Chengwen Feng --- usertools/dpdk-telemetry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py index a81868a547..63f8004566 100755 --- a/usertools/dpdk-telemetry.py +++ b/usertools/dpdk-telemetry.py @@ -27,7 +27,7 @@ def read_socket(sock, buf_len, echo=True): """ Read data from socket and return it in JSON format """ reply = sock.recv(buf_len).decode() try: - ret = json.loads(reply) + ret = json.loads(reply, strict=False) except json.JSONDecodeError: print("Error in reply: ", reply) sock.close() -- 2.33.0