[KVM-AUTOTEST PATCH 15/26] KVM test: kvm_monitor.py: don't unpack socket.error args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I couldn't find any guarantee in Python docs that all socket.error exceptions
in Python 2.4 contain a (errno, msg) tuple, so it's probably safer not to
assume that they do.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_monitor.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/client/tests/kvm/kvm_monitor.py b/client/tests/kvm/kvm_monitor.py
index 5d3422e..48d627f 100644
--- a/client/tests/kvm/kvm_monitor.py
+++ b/client/tests/kvm/kvm_monitor.py
@@ -119,9 +119,9 @@ class Monitor:
         while self._data_available():
             try:
                 data = self._socket.recv(1024)
-            except socket.error, (errno, msg):
+            except socket.error, e:
                 raise MonitorSocketError("Could not receive data from monitor "
-                                         "(%s)" % msg)
+                                         "(%s)" % e)
             if not data:
                 break
             s += data
@@ -212,9 +212,9 @@ class HumanMonitor(Monitor):
         try:
             try:
                 self._socket.sendall(cmd + "\n")
-            except socket.error, (errno, msg):
-                raise MonitorSocketError("Could not send monitor command '%s' "
-                                         "(%s)" % (cmd, msg))
+            except socket.error, e:
+                raise MonitorSocketError("Could not send monitor command %r "
+                                         "(%s)" % (cmd, e))
 
         finally:
             self._lock.release()
@@ -484,9 +484,9 @@ class QMPMonitor(Monitor):
         """
         try:
             self._socket.sendall(data)
-        except socket.error, (errno, msg):
+        except socket.error, e:
             raise MonitorSocketError("Could not send data: %r (%s)" %
-                                     (data, msg))
+                                     (data, e))
 
 
     def _get_response(self, id=None, timeout=20):
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux