diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-07-07 18:33:17 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-07-07 18:33:17 +0000 |
commit | dcad74ce85dd37db9f426e51b3313b20210aee31 (patch) | |
tree | bb4a6ecadc9062337ba1dad11436b11782e37409 | |
parent | 5298c7155dc99ce35dba158207eca9328dc73209 (diff) | |
download | paste-git-dcad74ce85dd37db9f426e51b3313b20210aee31.tar.gz |
Added more information about failed imports
-rw-r--r-- | paste/util/import_string.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/paste/util/import_string.py b/paste/util/import_string.py index d3e5771..2d3738c 100644 --- a/paste/util/import_string.py +++ b/paste/util/import_string.py @@ -23,12 +23,14 @@ def simple_import(s): module = import_module(parts[0]) name = parts[0] parts = parts[1:] + last_import_error = None while parts: name += '.' + parts[0] try: module = import_module(name) parts = parts[1:] - except ImportError: + except ImportError, e: + last_import_error = e break obj = module while parts: @@ -36,7 +38,7 @@ def simple_import(s): obj = getattr(module, parts[0]) except AttributeError: raise ImportError( - "Cannot find %s in module %r" % (parts[0], module)) + "Cannot find %s in module %r (stopped importing modules with error %s)" % (parts[0], module, last_import_error)) parts = parts[1:] return obj |