Move to python3 style except.
This commit is contained in:
parent
0493dc0b4e
commit
0384fcc63d
24 changed files with 47 additions and 47 deletions
|
|
@ -565,7 +565,7 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
|
|||
# catch it here and don't pass it on.
|
||||
pass
|
||||
|
||||
except ExecSystemCommand, exc:
|
||||
except ExecSystemCommand as exc:
|
||||
# Not a normal command: run a system command, if available,
|
||||
# or fall back to a return string.
|
||||
syscmd = exc.syscmd
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
cmdsetclass = cmdsetclass(cmdsetobj)
|
||||
errstring = ""
|
||||
return cmdsetclass
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
logger.log_trace()
|
||||
errstring += _("\nError loading cmdset {path}: \"{error}\"")
|
||||
errstring = errstring.format(path=python_path, error=e)
|
||||
|
|
@ -169,12 +169,12 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
errstring += _("\nError in loading cmdset: No cmdset class '{classname}' in {path}.")
|
||||
errstring = errstring.format(classname=classname, path=python_path)
|
||||
break
|
||||
except SyntaxError, e:
|
||||
except SyntaxError as e:
|
||||
logger.log_trace()
|
||||
errstring += _("\nSyntaxError encountered when loading cmdset '{path}': \"{error}\".")
|
||||
errstring = errstring.format(path=python_path, error=e)
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.log_trace()
|
||||
errstring += _("\nCompile/Run error when loading cmdset '{path}': \"{error}\".")
|
||||
errstring = errstring.format(path=python_path, error=e)
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class CmdBatchCommands(MuxCommand):
|
|||
|
||||
try:
|
||||
commands = BATCHCMD.parse_file(python_path)
|
||||
except UnicodeDecodeError, err:
|
||||
except UnicodeDecodeError as err:
|
||||
caller.msg(_UTF8_ERROR % (python_path, err))
|
||||
return
|
||||
except IOError as err:
|
||||
|
|
@ -346,7 +346,7 @@ class CmdBatchCode(MuxCommand):
|
|||
#parse indata file
|
||||
try:
|
||||
codes = BATCHCODE.parse_file(python_path, debug=debug)
|
||||
except UnicodeDecodeError, err:
|
||||
except UnicodeDecodeError as err:
|
||||
caller.msg(_UTF8_ERROR % (python_path, err))
|
||||
return
|
||||
except IOError:
|
||||
|
|
|
|||
|
|
@ -1774,7 +1774,7 @@ class CmdLock(ObjManipCommand):
|
|||
lockdef = re.sub(r"\'|\"", "", lockdef)
|
||||
try:
|
||||
ok = obj.locks.add(lockdef)
|
||||
except LockException, e:
|
||||
except LockException as e:
|
||||
caller.msg(str(e))
|
||||
if ok:
|
||||
caller.msg("Added lock '%s' to %s." % (lockdef, obj))
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class CmdIC(MuxPlayerCommand):
|
|||
try:
|
||||
player.puppet_object(sessid, new_character)
|
||||
player.db._last_puppet = new_character
|
||||
except RuntimeError, exc:
|
||||
except RuntimeError as exc:
|
||||
self.msg("{rYou cannot become {C%s{n: %s" % (new_character.name, exc))
|
||||
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ class CmdOOC(MuxPlayerCommand):
|
|||
player.unpuppet_object(sessid)
|
||||
self.msg("\n{GYou go OOC.{n\n")
|
||||
player.execute_cmd("look", sessid=sessid)
|
||||
except RuntimeError, exc:
|
||||
except RuntimeError as exc:
|
||||
self.msg("{rCould not unpuppet from {c%s{n: %s" % (old_char, exc))
|
||||
|
||||
class CmdSessions(MuxPlayerCommand):
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ def _create_player(session, playername, password, permissions, typeclass=None):
|
|||
new_player = create.create_player(playername, None, password,
|
||||
permissions=permissions, typeclass=typeclass)
|
||||
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
session.msg("There was an error creating the Player:\n%s\n If this problem persists, contact an admin." % e)
|
||||
logger.log_trace()
|
||||
return False
|
||||
|
|
@ -505,7 +505,7 @@ def _create_character(session, new_player, typeclass, home, permissions):
|
|||
new_character.db.desc = "This is a Player."
|
||||
# We need to set this to have @ic auto-connect to this character
|
||||
new_player.db._last_puppet = new_character
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
session.msg("There was an error creating the Character:\n%s\n If this problem persists, contact an admin." % e)
|
||||
logger.log_trace()
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue