Message218903
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 |
|
Date |
User |
Action |
Args |
2014-05-22 17:17:27 | peter.otten | set | recipients:
+ peter.otten, brett.cannon, ncoghlan, eric.snow, mythsmith |
2014-05-22 17:17:26 | peter.otten | set | messageid: <1400779046.99.0.0722556715482.issue21553@psf.upfronthosting.co.za> |
2014-05-22 17:17:26 | peter.otten | link | issue21553 messages |
2014-05-22 17:17:26 | peter.otten | create | |
|