[New-bugs-announce] [issue19257] Sub-optimal error message when importing a non-package

Alex Gaynor report at bugs.python.org
Mon Oct 14 09:29:15 CEST 2013


New submission from Alex Gaynor:

Use case:

Alexanders-MacBook-Pro:pypy alex_gaynor$ python3.3
Python 3.3.2 (default, May 29 2013, 14:03:57)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime.datetime
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1521, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'datetime.datetime'; datetime is not a package
>>>



Showing the user the original "module has no attribute __path__" error is just confusing, we should hide it.

----------
messages: 199847
nosy: alex
priority: normal
severity: normal
status: open
title: Sub-optimal error message when importing a non-package

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19257>
_______________________________________


More information about the New-bugs-announce mailing list