From 27549eca2e5669e2ff29e21a638f20550442f252 Mon Sep 17 00:00:00 2001 From: Russell Jones Date: Sun, 20 Dec 2015 14:14:02 +0000 Subject: [PATCH] Use 2/3 raise_() from future.utils --- evennia/commands/cmdsethandler.py | 5 +++-- evennia/utils/utils.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/evennia/commands/cmdsethandler.py b/evennia/commands/cmdsethandler.py index 3d59be479..237084bf2 100644 --- a/evennia/commands/cmdsethandler.py +++ b/evennia/commands/cmdsethandler.py @@ -64,6 +64,7 @@ example, you can have a 'On a boat' set, onto which you then tack on the 'Fishing' set. Fishing from a boat? No problem! """ from builtins import object +from future.utils import raise_ import sys from importlib import import_module from inspect import trace @@ -137,7 +138,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False): if len(trace()) > 2: # error in module, make sure to not hide it. exc = sys.exc_info() - raise exc[1], None, exc[2] + raise_(exc[1], None, exc[2]) else: # try next suggested path errstring += _("\n(Unsuccessfully tried '%s')." % python_path) @@ -148,7 +149,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False): if len(trace()) > 2: # Attribute error within module, don't hide it exc = sys.exc_info() - raise exc[1], None, exc[2] + raise_(exc[1], None, exc[2]) else: errstring += _("\n(Unsuccessfully tried '%s')." % python_path) continue diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 39776786c..8e14acf30 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -7,7 +7,7 @@ be of use when designing your own game. """ from __future__ import division, print_function from builtins import object, range -from future.utils import viewkeys +from future.utils import viewkeys, raise_ import os import sys @@ -1129,7 +1129,7 @@ def class_from_module(path, defaultpaths=None): # this means the error happened within the called module and # we must not hide it. exc = sys.exc_info() - raise exc[1], None, exc[2] + raise_(exc[1], None, exc[2]) else: # otherwise, try the next suggested path continue @@ -1140,7 +1140,7 @@ def class_from_module(path, defaultpaths=None): if len(trace()) > 2: # AttributeError within the module, don't hide it exc = sys.exc_info() - raise exc[1], None, exc[2] + raise_(exc[1], None, exc[2]) if not cls: err = "Could not load typeclass '%s'" % path if defaultpaths: