[libvirt-python 2/3] generator: Support exceptions in Python 2 and 3

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

 



Use a syntax for exception handling that works in both Python 2 and
Python 3
---
 generator.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/generator.py b/generator.py
index 0717624..009d3e1 100755
--- a/generator.py
+++ b/generator.py
@@ -818,7 +818,8 @@ def buildStubs(module, api_xml):
         (parser, target)  = getparser()
         parser.feed(data)
         parser.close()
-    except IOError, msg:
+    except IOError:
+        msg = sys.exc_info()[1]
         print(file, ":", msg)
         sys.exit(1)
 
@@ -837,7 +838,8 @@ def buildStubs(module, api_xml):
         (parser, target)  = getparser()
         parser.feed(data)
         parser.close()
-    except IOError, msg:
+    except IOError:
+        msg = sys.exc_info()[1]
         print(file, ":", msg)
 
     if not quiet:
-- 
1.8.3.2

--
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]