[PATCH python 11/15] examples: Fix exception catching syntax

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]