Open a9f0f04e-d35d-4bb1-aab8-c9205db013c8 opened 4 years ago
I have a test site containing nested namespace packages in zipped and unzipped eggs_
When using order "aaa, bbb, ccc" in PYTHONPATH, importing "nspkg3.bbb" FAILS, whereas when using order "bbb, aaa, ccc" in PYTHONPATH, importing "nspkg3.bbb" PASSES,
I would expect "nspk3.bbb" to ba importable 8as a namespace package) no matter which possition it has in PYTHONPATH.
How to reproduce
Preperation: get hands on the eggs in question:
$ wget https://github.com/pyinstaller/pyinstaller/archive/v3.5.zip
$ unzip v3.5.zip
$ cd pyinstaller-3.5/tests/functional/modules/nspkg3-pkg/
Order "aaa, bbb, ccc": fails
$ PYTHONPATH=nspkg3_aaa.egg:nspkg3_bbb.egg:nspkg3_ccc.egg python3.7 -c "import nspkg3.bbb.zzz"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'nspkg3.bbb'
Order "bbb, aaa, ccc": passes:
$ PYTHONPATH=nspkg3_bbb.egg:nspkg3_aaa.egg:nspkg3_ccc.egg python3.7 -c "import nspkg3.bbb.zzz"
this is module nspkg3.bbb.zzz
Further information
I did some research and found that the zipped egg (bbb) is *not added* to the package path when using order "aaa, bbb, ccc":
Order "aaa, bbb, ccc": bbb is missing here
$ PYTHONPATH=nspkg3_aaa.egg:nspkg3_bbb.egg:nspkg3_ccc.egg \
python3.7 -c "import nspkg3 ; print(nspkg3.__path__)"
['…/nspkg3_aaa.egg/nspkg3', '…/nspkg3_ccc.egg/nspkg3']
Order "bbb, aaa, ccc": bbb is included
$ PYTHONPATH=nspkg3_bbb.egg:nspkg3_aaa.egg:nspkg3_ccc.egg \
python3.7 -c "import nspkg3 ; print(nspkg3.__path__)"
['…/nspkg3_bbb.egg/nspkg3', '…/nspkg3_aaa.egg/nspkg3', '…/nspkg3_ccc.egg/nspkg3']
Also tested with Python 2.7: Same results
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['3.7', 'type-bug', 'library']
title = 'pkgutil.extend_path fails with zipped eggs if not at first place'
updated_at =
user = 'https://bugs.python.org/htgoebel'
```
bugs.python.org fields:
```python
activity =
actor = 'lkollar'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'htgoebel'
dependencies = []
files = []
hgrepos = []
issue_num = 38653
keywords = []
message_count = 1.0
messages = ['355745']
nosy_count = 2.0
nosy_names = ['htgoebel', 'lkollar']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue38653'
versions = ['Python 2.7', 'Python 3.7']
```