[pypy-issue] [issue1686] Issue with our zipimporter module

Brian Wickman tracker at bugs.pypy.org
Mon Feb 3 06:58:59 CET 2014


Brian Wickman <wickman at gmail.com> added the comment:

more minimal test case here (just a few files):
https://gist.github.com/wickman/8779443

it looks like when using namespace packages inside of zip files, it looks like the last write to __path__ wins and always 
overwrites the previous value:

---------------------------
python2.7 (dir)
twitter: <module 'twitter' from '/Users/wickman/work/2014.02.01.pypy_nspkg/code/twitter/__init__.py'>, twitter.__path__: 
['code/deps/twitter', 'code/twitter']
zipimporter: <zipimporter object "/Users/wickman/Python/CPython-2.7.6/lib/python2.7/site-packages/setuptools-2.0.2-
py2.7.egg">, archive: /Users/wickman/Python/CPython-2.7.6/lib/python2.7/site-packages/setuptools-2.0.2-py2.7.egg, prefix: 
---------------------------
pypy (dir)
twitter: <module 'twitter' from '/Users/wickman/work/2014.02.01.pypy_nspkg/code/twitter/__init__.py'>, twitter.__path__: 
['code/deps/twitter', 'code/twitter']
zipimporter: <zipimporter object at 0x0000000102f5a4f8>, archive: /Users/wickman/Python/PyPy-2.2.1/site-
packages/setuptools-2.0.2-py2.7.egg, prefix: 
---------------------------
python2.7 (pex)
twitter: <module 'twitter' from 'code.pex/twitter/__init__.py'>, twitter.__path__: ['code.pex/deps/twitter', 
'code.pex/twitter']
zipimporter: <zipimporter object "code.pex/deps/">, archive: code.pex, prefix: deps/
zipimporter: <zipimporter object "code.pex">, archive: code.pex, prefix: 
zipimporter: <zipimporter object "/Users/wickman/Python/CPython-2.7.6/lib/python2.7/site-packages/setuptools-2.0.2-
py2.7.egg">, archive: /Users/wickman/Python/CPython-2.7.6/lib/python2.7/site-packages/setuptools-2.0.2-py2.7.egg, prefix: 
---------------------------
pypy (pex)
twitter: <module 'twitter' from 'code.pex/twitter/__init__.py'>, twitter.__path__: ['code.pex/twitter']
zipimporter: <zipimporter object at 0x0000000102f5a4f8>, archive: code.pex, prefix: deps/
zipimporter: <zipimporter object at 0x0000000102f5b8f8>, archive: code.pex, prefix: 
zipimporter: <zipimporter object at 0x0000000102f5a408>, archive: /Users/wickman/Python/PyPy-2.2.1/site-
packages/setuptools-2.0.2-py2.7.egg, prefix: 
Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "/Users/wickman/Python/PyPy-2.2.1/lib-python/2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/wickman/Python/PyPy-2.2.1/lib-python/2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "code.pex/__main__.py", line 17, in <module>
    import twitter.aurora
ImportError: No module named twitter.aurora

----------
nosy: +wickman

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1686>
________________________________________


More information about the pypy-issue mailing list