[PATCH python 15/15] override: 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>
---
 libvirt-override-virStream.py | 6 +++---
 libvirt-override.py           | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
index 53000da..cf54a01 100644
--- a/libvirt-override-virStream.py
+++ b/libvirt-override-virStream.py
@@ -50,12 +50,12 @@
                 ret = handler(self, got, opaque)
                 if type(ret) is int and ret < 0:
                     raise RuntimeError("recvAll handler returned %d" % ret)
-            except Exception, e:
+            except:
                 try:
                     self.abort()
                 except:
                     pass
-                raise e
+                raise
 
     def sendAll(self, handler, opaque):
         """
@@ -79,7 +79,7 @@
                     self.abort()
                 except:
                     pass
-                raise e
+                raise
 
             if got == "":
                 break
diff --git a/libvirt-override.py b/libvirt-override.py
index 87996f8..e356a10 100644
--- a/libvirt-override.py
+++ b/libvirt-override.py
@@ -5,10 +5,10 @@
 # On cygwin, the DLL is called cygvirtmod.dll
 try:
     import libvirtmod
-except ImportError, lib_e:
+except ImportError as lib_e:
     try:
         import cygvirtmod as libvirtmod
-    except ImportError, cyg_e:
+    except ImportError as cyg_e:
         if str(cyg_e).count("No module named"):
             raise lib_e
 
-- 
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]