summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-05-20 15:30:19 +0000
committerianb <devnull@localhost>2005-05-20 15:30:19 +0000
commit9888f30d532182e6b62f19ca2ce9487579e4a86c (patch)
tree3d567a7c8764ae93f1c3fd784d47d8bddc3992f9 /paste
parent274c7f48a3154e01428da6fc0c249dddf81ae7f9 (diff)
downloadpaste-9888f30d532182e6b62f19ca2ce9487579e4a86c.tar.gz
Added better error messages when modules not found
Diffstat (limited to 'paste')
-rw-r--r--paste/util/thirdparty.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/paste/util/thirdparty.py b/paste/util/thirdparty.py
index 78eeadc..0883372 100644
--- a/paste/util/thirdparty.py
+++ b/paste/util/thirdparty.py
@@ -20,7 +20,15 @@ def load_new_module(module_name, python_version):
if python_version > sys.version_info:
if new_python_path not in sys.path:
sys.path.append(new_python_path)
- exec "import python.%s as generic_module" % module_name
+ try:
+ exec "import python.%s as generic_module" % module_name
+ except ImportError, e:
+ raise ImportError(
+ "Cannot load backported (from python version %s) "
+ "stdlib module %s; expected to find it in %s"
+ % ('.'.join(map(str, python_version)),
+ module_name,
+ os.path.join(new_python_path, 'python')))
else:
exec "import %s as generic_module" % module_name
return generic_module
@@ -40,3 +48,8 @@ def add_package(package_name):
path = os.path.join(third_party, '%s-files' % package_name)
if os.path.exists(path):
sys.path.append(path)
+ else:
+ raise ImportError(
+ "Cannot load the package %s; expected to find it in "
+ "%s. Have you run build-pkg.py?"
+ % (package_name, path))