Use 2/3 raise_() from future.utils
This commit is contained in:
parent
f10f4ddc98
commit
27549eca2e
2 changed files with 6 additions and 5 deletions
|
|
@ -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!
|
the 'Fishing' set. Fishing from a boat? No problem!
|
||||||
"""
|
"""
|
||||||
from builtins import object
|
from builtins import object
|
||||||
|
from future.utils import raise_
|
||||||
import sys
|
import sys
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from inspect import trace
|
from inspect import trace
|
||||||
|
|
@ -137,7 +138,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
||||||
if len(trace()) > 2:
|
if len(trace()) > 2:
|
||||||
# error in module, make sure to not hide it.
|
# error in module, make sure to not hide it.
|
||||||
exc = sys.exc_info()
|
exc = sys.exc_info()
|
||||||
raise exc[1], None, exc[2]
|
raise_(exc[1], None, exc[2])
|
||||||
else:
|
else:
|
||||||
# try next suggested path
|
# try next suggested path
|
||||||
errstring += _("\n(Unsuccessfully tried '%s')." % python_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:
|
if len(trace()) > 2:
|
||||||
# Attribute error within module, don't hide it
|
# Attribute error within module, don't hide it
|
||||||
exc = sys.exc_info()
|
exc = sys.exc_info()
|
||||||
raise exc[1], None, exc[2]
|
raise_(exc[1], None, exc[2])
|
||||||
else:
|
else:
|
||||||
errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
|
errstring += _("\n(Unsuccessfully tried '%s')." % python_path)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ be of use when designing your own game.
|
||||||
"""
|
"""
|
||||||
from __future__ import division, print_function
|
from __future__ import division, print_function
|
||||||
from builtins import object, range
|
from builtins import object, range
|
||||||
from future.utils import viewkeys
|
from future.utils import viewkeys, raise_
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -1129,7 +1129,7 @@ def class_from_module(path, defaultpaths=None):
|
||||||
# this means the error happened within the called module and
|
# this means the error happened within the called module and
|
||||||
# we must not hide it.
|
# we must not hide it.
|
||||||
exc = sys.exc_info()
|
exc = sys.exc_info()
|
||||||
raise exc[1], None, exc[2]
|
raise_(exc[1], None, exc[2])
|
||||||
else:
|
else:
|
||||||
# otherwise, try the next suggested path
|
# otherwise, try the next suggested path
|
||||||
continue
|
continue
|
||||||
|
|
@ -1140,7 +1140,7 @@ def class_from_module(path, defaultpaths=None):
|
||||||
if len(trace()) > 2:
|
if len(trace()) > 2:
|
||||||
# AttributeError within the module, don't hide it
|
# AttributeError within the module, don't hide it
|
||||||
exc = sys.exc_info()
|
exc = sys.exc_info()
|
||||||
raise exc[1], None, exc[2]
|
raise_(exc[1], None, exc[2])
|
||||||
if not cls:
|
if not cls:
|
||||||
err = "Could not load typeclass '%s'" % path
|
err = "Could not load typeclass '%s'" % path
|
||||||
if defaultpaths:
|
if defaultpaths:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue