`list_distinfo_files()` on egg raises IOError

Issue #97 resolved
htgoebel
created an issue

When running list_distinfo_files() on a zipped egg distribution, this crashes with an IOError "Not a directory …"

To reprocude you can simply use thus small zipped egg: https://github.com/pyinstaller/pyinstaller/raw/v3.2.1/tests/functional/modules/nspkg1-pkg/nspkg1_bbb.egg

>>> from distlib.database import DistributionPath
>>> dist_path = DistributionPath(['.'], include_egg=True)
>>> list(dist_path.get_distributions())
[<EggInfoDistribution u'nspkg1-bbb' 0.1 at u'/tmp/test/nspkg1_bbb.egg'>]
>>> d = list(dist_path.get_distributions())[0]
>>> d.list_installed_files()
[]
>>> list(d.list_distinfo_files())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/myvenv/lib/python2.7/site-packages/distlib/database.py", line 1029, in list_distinfo_files
    with codecs.open(record_path, 'r', encoding='utf-8') as f:
  File "/tmp/myvenv/lib64/python2.7/codecs.py", line 896, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 20] Not a directory: u'/tmp/myvenv/nspkg1_bbb.egg/installed-files.txt'

Comments (3)

  1. htgoebel reporter

    Addendum: This not only happens with zipped eggs, but also with unzipped eggs.

    A quick way to get the egg I've tested it with is:

    git init xxx
    cd xxx
    git fetch https://github.com/pyinstaller/pyinstaller --depth=1 v3.2.1
    git checkout FETCH_HEAD
    mv tests/functional/modules/nspkg1-pkg/nspkg1_aaa.egg/ ..
    cd ..
    rm -rf xxx
    
  2. Log in to comment