diff options
| author | ianb <devnull@localhost> | 2005-07-07 18:33:17 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-07-07 18:33:17 +0000 |
| commit | e62d66332f4afccca474651ee0648460a9bbcfa0 (patch) | |
| tree | bb4a6ecadc9062337ba1dad11436b11782e37409 /paste/util | |
| parent | 87f4f3dfd4f99c0150abcbdf27b88eb59c1e88e0 (diff) | |
| download | paste-e62d66332f4afccca474651ee0648460a9bbcfa0.tar.gz | |
Added more information about failed imports
Diffstat (limited to 'paste/util')
| -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 |
