Move to python3 style except.
This commit is contained in:
parent
0493dc0b4e
commit
0384fcc63d
24 changed files with 47 additions and 47 deletions
|
|
@ -230,7 +230,7 @@ def read_batchfile(pythonpath, file_ending='.py'):
|
|||
try:
|
||||
with codecs.open(abspath, 'r', encoding=file_encoding) as fobj:
|
||||
text = fobj.read()
|
||||
except (ValueError, UnicodeDecodeError), e:
|
||||
except (ValueError, UnicodeDecodeError) as e:
|
||||
# this means an encoding error; try another encoding
|
||||
decoderr.append(str(e))
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ class EvEditor(object):
|
|||
"""
|
||||
try:
|
||||
self._buffer = self._loadfunc(self._caller)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_LOADFUNC.format(error=e))
|
||||
|
||||
def get_buffer(self):
|
||||
|
|
@ -661,7 +661,7 @@ class EvEditor(object):
|
|||
"""
|
||||
try:
|
||||
self._quitfunc(self._caller)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_QUITFUNC.format(error=e))
|
||||
del self._caller.ndb._lineeditor
|
||||
self._caller.cmdset.remove(EvEditorCmdSet)
|
||||
|
|
@ -679,7 +679,7 @@ class EvEditor(object):
|
|||
# save worked. The saving function is responsible for
|
||||
# any status messages.
|
||||
self._unsaved = False
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self._caller.msg(_ERROR_SAVEFUNC.format(error=e))
|
||||
else:
|
||||
self._caller.msg(_MSG_SAVE_NO_CHANGE)
|
||||
|
|
|
|||
|
|
@ -1266,7 +1266,7 @@ class EvTable(object):
|
|||
for ix, col in enumerate(self.worktable):
|
||||
try:
|
||||
col.reformat(width=cwidths[ix], **options)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = "ix=%s, width=%s: %s" % (ix, cwidths[ix], e.message)
|
||||
raise #Exception ("Error in horizontal allign:\n %s" % msg)
|
||||
|
||||
|
|
@ -1315,7 +1315,7 @@ class EvTable(object):
|
|||
for iy, cell in enumerate(col):
|
||||
try:
|
||||
col.reformat_cell(iy, height=cheights[iy], **options)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = "ix=%s, iy=%s, height=%s: %s" % (ix, iy, cheights[iy], e.message)
|
||||
raise Exception ("Error in vertical allign:\n %s" % msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def log_trace(errmsg=None):
|
|||
if errmsg:
|
||||
try:
|
||||
errmsg = str(errmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
errmsg = str(e)
|
||||
for line in errmsg.splitlines():
|
||||
log.msg('[EE] %s' % line)
|
||||
|
|
@ -59,7 +59,7 @@ def log_err(errmsg):
|
|||
"""
|
||||
try:
|
||||
errmsg = str(errmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
errmsg = str(e)
|
||||
for line in errmsg.splitlines():
|
||||
log.msg('[EE] %s' % line)
|
||||
|
|
@ -77,7 +77,7 @@ def log_warn(warnmsg):
|
|||
"""
|
||||
try:
|
||||
warnmsg = str(warnmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
warnmsg = str(e)
|
||||
for line in warnmsg.splitlines():
|
||||
log.msg('[WW] %s' % line)
|
||||
|
|
@ -93,7 +93,7 @@ def log_info(infomsg):
|
|||
"""
|
||||
try:
|
||||
infomsg = str(infomsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
infomsg = str(e)
|
||||
for line in infomsg.splitlines():
|
||||
log.msg('[..] %s' % line)
|
||||
|
|
@ -109,7 +109,7 @@ def log_dep(depmsg):
|
|||
"""
|
||||
try:
|
||||
depmsg = str(depmsg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
depmsg = str(e)
|
||||
for line in depmsg.splitlines():
|
||||
log.msg('[DP] %s' % line)
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ class WebSocketProtocol(ProtocolWrapper):
|
|||
|
||||
try:
|
||||
frames, self.buf = parser(self.buf)
|
||||
except WSException, wse:
|
||||
except WSException as wse:
|
||||
# Couldn't parse all the frames, something went wrong, let's bail.
|
||||
self.close(wse.args[0])
|
||||
return
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue