On Tue, Dec 3, 2013 at 10:36 AM, Daniel P. Berrange <berrange(a)redhat.com> wrote:
From: "Daniel P. Berrange" <berrange(a)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(a)redhat.com>
---
generator.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/generator.py b/generator.py
index 17f00d6..6fe810f 100755
--- a/generator.py
+++ b/generator.py
@@ -1812,10 +1812,10 @@ def qemuBuildWrappers(module):
fd.write("try:\n")
fd.write(" import libvirtmod_qemu\n")
- fd.write("except ImportError, lib_e:\n")
+ fd.write("except ImportError as lib_e:\n")
fd.write(" try:\n")
fd.write(" import cygvirtmod_qemu as libvirtmod_qemu\n")
- fd.write(" except ImportError, cyg_e:\n")
+ fd.write(" except ImportError as cyg_e:\n")
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
fd.write(" raise lib_e\n\n")
@@ -1923,10 +1923,10 @@ def lxcBuildWrappers(module):
fd.write("try:\n")
fd.write(" import libvirtmod_lxc\n")
- fd.write("except ImportError, lib_e:\n")
+ fd.write("except ImportError as lib_e:\n")
fd.write(" try:\n")
fd.write(" import cygvirtmod_lxc as libvirtmod_lxc\n")
- fd.write(" except ImportError, cyg_e:\n")
+ fd.write(" except ImportError as cyg_e:\n")
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
fd.write(" raise lib_e\n\n")
--
1.8.3.1
We'll want to use sys.exc_info() for the exceptions here so older Python compat.
--
Doug Goldstein