1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-12-02 12:23:47 +03:00

override: Simplify exception handling

sys.exc_info() returns a 3-tuple (type, value, traceback), where `value`
is the instance captured by `except type as value`.

Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
Philipp Hahn
2018-11-20 08:59:35 +01:00
committed by Daniel Berrange
parent ec76ba3507
commit 67af8b910b

View File

@@ -3,17 +3,13 @@
#
# On cygwin, the DLL is called cygvirtmod.dll
import sys
try:
import libvirtmod
except ImportError:
lib_e = sys.exc_info()[1]
except ImportError as lib_e:
try:
import cygvirtmod as libvirtmod
except ImportError:
cyg_e = sys.exc_info()[1]
if str(cyg_e).count("No module named"):
except ImportError as cyg_e:
if "No module named" in str(cyg_e):
raise lib_e