This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author David Hagen
Recipients David Hagen
Date 2017-09-07.19:11:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504811519.66.0.997643524015.issue31385@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following Python project:

bugtest/
  __init__.py (Contents: from .foo import *)
  foo/
    __init__.py (Contents: from .foo import *)
    foo.py (Contents: <empty file>)

Then in a Python session, the following line executes without error (as expected):

>>> import bugtest.foo.foo

However, the following line gives an error (not as expected):

>>> import bugtest.foo.foo as bar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'bugtest.foo.foo' has no attribute 'foo'

Note that this behavior is dependent on the folder foo and the file foo.py having the same base name. But is not dependent on actually trying to import bugtest.foo.foo. Trying to import bugtest.foo.baz will also fail as long as bugtest.foo.foo exists.

It is also dependent on the __init__.py files importing something from their respective submodules.
History
Date User Action Args
2017-09-07 19:11:59David Hagensetrecipients: + David Hagen
2017-09-07 19:11:59David Hagensetmessageid: <1504811519.66.0.997643524015.issue31385@psf.upfronthosting.co.za>
2017-09-07 19:11:59David Hagenlinkissue31385 messages
2017-09-07 19:11:59David Hagencreate