Move to python3 style except.

This commit is contained in:
Ahmed Charles 2015-10-18 21:45:54 +00:00 committed by Griatch
parent 0493dc0b4e
commit 0384fcc63d
24 changed files with 47 additions and 47 deletions

View file

@ -926,7 +926,7 @@ def mod_import(module):
if errmsg:
try:
errmsg = to_str(errmsg)
except Exception, e:
except Exception as e:
errmsg = str(e)
for line in errmsg.splitlines():
log.msg('[EE] %s' % line)
@ -941,7 +941,7 @@ def mod_import(module):
# first try to import as a python path
try:
mod = __import__(module, fromlist=["None"])
except ImportError, ex:
except ImportError as ex:
# check just where the ImportError happened (it could have been
# an erroneous import inside the module as well). This is the
# trivial way to do it ...
@ -1104,7 +1104,7 @@ def fuzzy_import_from_module(path, variable, default=None, defaultpaths=None):
for modpath in paths:
try:
mod = import_module(path)
except ImportError, ex:
except ImportError as ex:
if not str(ex).startswith ("No module named %s" % path):
# this means the module was found but it
# triggers an ImportError on import.