qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org,
	mdroth@linux.vnet.ibm.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] scripts/qmp: Use Python 2.6 "except E as ..." syntax
Date: Thu, 17 Dec 2015 11:06:29 +0100	[thread overview]
Message-ID: <1450346791-25562-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1450346791-25562-1-git-send-email-armbru@redhat.com>

PEP 8 calls for it, because it's forward compatibile with Python 3.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qmp/qemu-ga-client | 2 +-
 scripts/qmp/qmp            | 4 ++--
 scripts/qmp/qmp-shell      | 2 +-
 scripts/qmp/qmp.py         | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/qmp/qemu-ga-client b/scripts/qmp/qemu-ga-client
index 9908f21..fd05605 100755
--- a/scripts/qmp/qemu-ga-client
+++ b/scripts/qmp/qemu-ga-client
@@ -259,7 +259,7 @@ def main(address, cmd, args):
 
     try:
         client = QemuGuestAgentClient(address)
-    except QemuGuestAgent.error, e:
+    except QemuGuestAgent.error as e:
         import errno
 
         print(e)
diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp
index 1db3c7f..514b539 100755
--- a/scripts/qmp/qmp
+++ b/scripts/qmp/qmp
@@ -91,8 +91,8 @@ def main(args):
         try:
             os.environ['QMP_PATH'] = path
             os.execvp(fullcmd, [fullcmd] + args)
-        except OSError, (errno, msg):
-            if errno == 2:
+        except OSError as exc:
+            if exc.errno == 2:
                 print 'Command "%s" not found.' % (fullcmd)
                 return 1
             raise
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index fa39bf0..7a402ed 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -240,7 +240,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
     def _execute_cmd(self, cmdline):
         try:
             qmpcmd = self.__build_cmd(cmdline)
-        except Exception, e:
+        except Exception as e:
             print 'Error while parsing command line: %s' % e
             print 'command format: <command-name> ',
             print '[arg-name1=arg1] ... [arg-nameN=argN]'
diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py
index 1d38e3e..779332f 100644
--- a/scripts/qmp/qmp.py
+++ b/scripts/qmp/qmp.py
@@ -92,7 +92,7 @@ class QEMUMonitorProtocol:
         self.__sock.setblocking(0)
         try:
             self.__json_read()
-        except socket.error, err:
+        except socket.error as err:
             if err[0] == errno.EAGAIN:
                 # No data available
                 pass
@@ -150,7 +150,7 @@ class QEMUMonitorProtocol:
         """
         try:
             self.__sock.sendall(json.dumps(qmp_cmd))
-        except socket.error, err:
+        except socket.error as err:
             if err[0] == errno.EPIPE:
                 return
             raise socket.error(err)
-- 
2.4.3

  parent reply	other threads:[~2015-12-17 10:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17 10:06 [Qemu-devel] [PATCH 0/4] Use Python 2.6 "except E as ..." syntax Markus Armbruster
2015-12-17 10:06 ` [Qemu-devel] [PATCH 1/4] qapi: " Markus Armbruster
2015-12-17 17:26   ` Eric Blake
2015-12-17 18:35     ` Markus Armbruster
2015-12-17 19:58       ` Eric Blake
2015-12-17 20:00   ` Peter Maydell
2015-12-17 10:06 ` Markus Armbruster [this message]
2015-12-17 17:27   ` [Qemu-devel] [PATCH 2/4] scripts/qmp: " Eric Blake
2015-12-17 10:06 ` [Qemu-devel] [PATCH 3/4] Revert "tracetool: use Python 2.4-compatible exception handling syntax" Markus Armbruster
2015-12-17 17:28   ` Eric Blake
2015-12-17 18:37     ` Markus Armbruster
2015-12-17 19:59       ` Eric Blake
2015-12-17 10:06 ` [Qemu-devel] [PATCH 4/4] tests: Use Python 2.6 "except E as ..." syntax Markus Armbruster
2015-12-17 17:29   ` Eric Blake
2015-12-18  5:10 ` [Qemu-devel] [PATCH 0/4] " Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450346791-25562-3-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).