Jason R. Coombs <[email protected]> added the comment:
Sorry for the mistake.
I corrected the pkgB package, but the result is the same:
jaraco@devjaraco:~$ tree master
master
├── __init__.py
├── __init__.pyc
├── pkgA
│ ├── foo.py
│ ├── foo.pyc
│ ├── __init__.py
│ └── __init__.pyc
└── pkgB
├── bar.py
└── __init__.py
2 directories, 8 files
jaraco@devjaraco:~$ python2.7 -c 'import master.pkgA;
print("pkgA.__package__ is {}".format(master.pkgA.__package__)); import
master.pkgA.foo'
pkgA.__package__ is None
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "master/pkgA/foo.py", line 2, in <module>
bar = __import__('pkgB', level=1).bar
ImportError: No module named pkgB
As you can see, __package__ for pkgA is None. Same is true for
master.__package__.
----------
resolution: invalid ->
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13912>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com