[issue20899] Nested namespace imports do not work inside zip archives

Andrey Antsut report at bugs.python.org
Wed Mar 12 21:30:25 CET 2014


New submission from Andrey Antsut:

Importing modules from subdirectories as "implicit namespace packages" (PEP 420) inside a ZIP archive only works one level deep. Imports from within nested namespaces fail with "ImportError: No module named 'XXX'".

I am attaching an archive with example directory/file structure. To reproduce the problem, run the following from where you unzipped it:

python
>>> import sys
>>> sys.path += ['project1', 'project2.zip', 'project3', 'project4.zip']
>>> import parent.child.hello1
Hello 1
>>> import parent.child.hello2
ImportError: No module named 'parent.child.hello2'
>>> import parent.child.hello3
Hello 3
>>> import parent.child.hello4
ImportError: No module named 'parent.child.hello4'
>>> import boo
boo!
>>> import parent.boo
boo!

Tested on WinXP SP3 with Python 3.3.5 and 3.4.0rc3.

----------
files: reproduce.zip
messages: 213290
nosy: Andrey.Antsut
priority: normal
severity: normal
status: open
title: Nested namespace imports do not work inside zip archives
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file34380/reproduce.zip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20899>
_______________________________________


More information about the Python-bugs-list mailing list