From 5b13f4375d44b4dee6a548b21e63eb2a2342c874 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 19 May 2009 13:03:03 +0000 Subject: [PATCH] Better error reporting if 'import libvirtmod' fails Don't squash a possibly legitimate libvirtmod error (e.g. some from clashing libvirt.so versions) with 'Cannot import cygvirtmod' --- ChangeLog | 4 ++++ python/libvir.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6545a01617..4dbc5dad1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue May 19 09:00:43 EDT 2009 Cole Robinson + + * python/libvir.py: Don't overwrite legitimate python import error. + Tue May 19 12:04:22 BST 2009 Daniel P. Berrange Fix misc locking bugs identified by lock checker diff --git a/python/libvir.py b/python/libvir.py index 8a16dd0be8..3cda8dc77c 100644 --- a/python/libvir.py +++ b/python/libvir.py @@ -8,8 +8,12 @@ # On cygwin, the DLL is called cygvirtmod.dll try: import libvirtmod -except: - import cygvirtmod as libvirtmod +except ImportError, lib_e: + try: + import cygvirtmod as libvirtmod + except ImportError, cyg_e: + if str(cyg_e).count("No module named"): + raise lib_e import types