Peter Otten added the comment:

Here's a simpler demo for what I believe you are experiencing:

$ mkdir package
$ cd package/
$ touch __ini__.py module.py
$ export PYTHONPATH=..
$ python3
Python 3.3.2+ (default, Feb 28 2014, 00:52:16) 
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import module, package.module
>>> module is package.module
False

Even though module and package.module correspond to the same file
Python does not recognize that you intend the former to be part of a package. 
Your run0.py script goes through its sys.path entries and unfortunately the 
first entry points into a package so that all modules in that package become 
also visible as toplevel modules.

A good way to avoid this trap is to use relative imports

>>> from . import module
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: Parent module '' not loaded, cannot perform relative import

----------
nosy: +peter.otten

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21553>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to