test suite reviews and discussions
 help / color / mirror / Atom feed
* [PATCH v1] dep/QMP: fix pylama errors
@ 2021-12-06 12:29 Juraj Linkeš
  2022-01-14  8:10 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Juraj Linkeš @ 2021-12-06 12:29 UTC (permalink / raw)
  To: lijuan.tu, ohilyard; +Cc: dts, Juraj Linkeš

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š <juraj.linkes@pantheon.tech>
---
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)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-14  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 12:29 [PATCH v1] dep/QMP: fix pylama errors Juraj Linkeš
2022-01-14  8:10 ` Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).