From patchwork Mon Dec 6 12:29:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 104949 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA902A034F; Mon, 6 Dec 2021 13:29:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3F6641160; Mon, 6 Dec 2021 13:29:32 +0100 (CET) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id 242C4410E5 for ; Mon, 6 Dec 2021 13:29:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id A1274130F7E; Mon, 6 Dec 2021 13:29:30 +0100 (CET) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id npfo7TrQQigC; Mon, 6 Dec 2021 13:29:08 +0100 (CET) Received: from service-node1.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id 1ECBA10DDBC; Mon, 6 Dec 2021 13:29:08 +0100 (CET) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: lijuan.tu@intel.com, ohilyard@iol.unh.edu Cc: dts@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1] dep/QMP: fix pylama errors Date: Mon, 6 Dec 2021 13:29:07 +0100 Message-Id: <1638793747-3143-1-git-send-email-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Pylama found the following errors: dep/QMP/qmp.py:114: [E] E1136 Value 'err' is unsubscriptable [pylint] dep/QMP/qmp.py:153: [E] E1136 Value 'err' is unsubscriptable [pylint] dep/QMP/qmp.py:173: [E] E1136 Value 'err' is unsubscriptable [pylint] - replace the deprecated Exception and fix errno Signed-off-by: Juraj Linkeš --- Lijuan, please add additional people to review if needed. --- dep/QMP/qmp.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dep/QMP/qmp.py b/dep/QMP/qmp.py index 3fd5f1b2..63d3117d 100755 --- a/dep/QMP/qmp.py +++ b/dep/QMP/qmp.py @@ -1,5 +1,5 @@ # QEMU Monitor Protocol Python class -# +# # Copyright (C) 2009, 2010 Red Hat Inc. # # Authors: @@ -110,8 +110,8 @@ class QEMUMonitorProtocol: """ try: self.__sock.sendall(str.encode(json.dumps(qmp_cmd))) - except socket.error as err: - if err[0] == errno.EPIPE: + except OSError as err: + if err.errno == errno.EPIPE: return raise socket.error(err) return self.__json_read() @@ -149,8 +149,8 @@ class QEMUMonitorProtocol: self.__sock.setblocking(0) try: self.__json_read() - except socket.error as err: - if err[0] == errno.EAGAIN: + except OSError as err: + if err.errno == errno.EAGAIN: # No data available pass self.__sock.setblocking(1) @@ -169,8 +169,8 @@ class QEMUMonitorProtocol: self.__sock.setblocking(0) try: self.__json_read() - except socket.error as err: - if err[0] == errno.EAGAIN: + except OSError as err: + if err.errno == errno.EAGAIN: # No data available pass self.__sock.setblocking(1)