[libvirt] [PATCH python 11/15] examples: Fix exception catching syntax
Daniel P. Berrange
berrange at redhat.com
Tue Dec 3 16:36:47 UTC 2013
From: "Daniel P. Berrange" <berrange at redhat.com>
In Python3 you cannot use 'except Foo, e' you must use
'except Foo as e' instead, or just 'except Foo' if the
variable isn't required.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
examples/event-test.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/event-test.py b/examples/event-test.py
index cf1a8b8..7fd9867 100644
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -220,7 +220,7 @@ class virEventLoopPure:
t.set_last_fired(now)
t.dispatch()
- except (os.error, select.error), e:
+ except (os.error, select.error) as e:
if e.args[0] != errno.EINTR:
raise
finally:
@@ -520,7 +520,7 @@ def usage():
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hdl", ["help", "debug", "loop"])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
# print help information and exit:
print(str(err)) # will print something like "option -a not recognized"
usage()
--
1.8.3.1
More information about the libvir-list
mailing list