summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-11-18 03:03:04 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-11-18 03:03:04 (GMT)
commit0ffe6a976060431c294e4e5e2a0324a67bc9cf97 (patch)
tree0684326ce1022645dea9ca4dbb58e01859bb4302 /Lib/importlib
parent8fb9b868bd8415347ffa608eec324055ff9f66d7 (diff)
downloadcpython-0ffe6a976060431c294e4e5e2a0324a67bc9cf97.zip
cpython-0ffe6a976060431c294e4e5e2a0324a67bc9cf97.tar.gz
cpython-0ffe6a976060431c294e4e5e2a0324a67bc9cf97.tar.bz2
Fix a minor inconsistency in capitalization for the 'No module named' exception
message in importlib. Thanks to Éric Araujo for spotting the inconsistency.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 1a37a89..9e54554 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -758,6 +758,8 @@ class _ImportLockContext:
_IMPLICIT_META_PATH = [BuiltinImporter, FrozenImporter, _DefaultPathFinder]
+_ERR_MSG = 'No module named {}'
+
def _gcd_import(name, package=None, level=0):
"""Import and return the module based on its name, the package the call is
being made from, and the level adjustment.
@@ -808,8 +810,8 @@ def _gcd_import(name, package=None, level=0):
try:
path = parent_module.__path__
except AttributeError:
- raise ImportError("no module named {}; "
- "{} is not a package".format(name, parent))
+ msg = (_ERR_MSG + '; {} is not a package').format(name, parent)
+ raise ImportError(msg)
meta_path = sys.meta_path + _IMPLICIT_META_PATH
for finder in meta_path:
loader = finder.find_module(name, path)
@@ -817,7 +819,7 @@ def _gcd_import(name, package=None, level=0):
loader.load_module(name)
break
else:
- raise ImportError("No module named {0}".format(name))
+ raise ImportError(_ERR_MSG.format(name))
# Backwards-compatibility; be nicer to skip the dict lookup.
module = sys.modules[name]
if parent: