aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-12-18 08:52:42 +0100
committerMarkus Armbruster <armbru@redhat.com>2016-02-08 17:29:54 +0100
commitcf6c63456b47118a7f0fbb917c220c0a483db6de (patch)
treec17387899208582087074bc5685b8328b76b5866 /scripts
parent291928a80f39670929fcce222acd5e21d1434692 (diff)
downloadqemu-cf6c63456b47118a7f0fbb917c220c0a483db6de.zip
qemu-cf6c63456b47118a7f0fbb917c220c0a483db6de.tar.gz
qemu-cf6c63456b47118a7f0fbb917c220c0a483db6de.tar.bz2
scripts/qmp: Use Python 2.6 "except E as ..." syntax
PEP 8 calls for it, because it's forward compatible with Python 3. Supported since Python 2.6, which we require (commit fec2103). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <1450425164-24969-3-git-send-email-armbru@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qmp/qemu-ga-client2
-rwxr-xr-xscripts/qmp/qmp4
-rwxr-xr-xscripts/qmp/qmp-shell2
-rw-r--r--scripts/qmp/qmp.py4
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)