diff options
Diffstat (limited to 'Lib/importlib/__init__.py')
-rw-r--r-- | Lib/importlib/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index aab54a7f18..6732977a2b 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -85,7 +85,9 @@ def import_module(name, package=None): level = 0 if name.startswith('.'): if not package: - raise TypeError("relative imports require the 'package' argument") + msg = ("the 'package' argument is required to perform a relative " + "import for {!r}") + raise TypeError(msg.format(name)) for character in name: if character != '.': break |