1. Tarek Ziadé
  2. distribute
Issue #269 resolved

AttributeError: NoneType has no attribute 'close'

Jason R. Coombs
created an issue

I recently found an error in sdist when running egg_info against a distribution with an invalid Manifest.in on Python 2.7.2.

{{{ PS C:\Users\jaraco\G\panoptic> ./setup egg_info running egg_info writing requirements to panoptic.egg-info\requires.txt writing panoptic.egg-info\PKG-INFO writing top-level names to panoptic.egg-info\top_level.txt writing dependency_links to panoptic.egg-info\dependency_links.txt writing entry points to panoptic.egg-info\entry_points.txt reading manifest template 'MANIFEST.in' Traceback (most recent call last): File "C:\Users\jaraco\G\panoptic\setup.py", line 46, in <module> setup_requires=["hgtools"], ... File "C:\Python\lib\site-packages\distribute-0.6.24-py2.7.egg\setuptools\command\egg_info.py", line 179, in run self.find_sources() ... File "C:\Python\lib\site-packages\distribute-0.6.24-py2.7.egg\setuptools\command\egg_info.py", line 310, in run self.read_template() File "C:\Python\lib\site-packages\distribute-0.6.24-py2.7.egg\setuptools\command\sdist.py", line 210, in read_template sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close() File "C:\Python\lib\distutils\text_file.py", line 128, in close self.file.close () AttributeError: 'NoneType' object has no attribute 'close' }}}

The error was masking the true error, which should have been:

{{{ ... File "C:\Python\lib\distutils\util.py", line 201, in convert_path raise ValueError, "path '%s' cannot end with '/'" % pathname ValueError: path 'panoptic/htmldocs/' cannot end with '/' }}}

It turns out that the [[https://bitbucket.org/tarek/distribute/src/7adbe664bfff/setuptools/command/sdist.py#cl-202|grody hack]] is patching a problem that was [[https://bitbucket.org/mirror/cpython/changeset/316d792bf75b|fixed]] in recent releases of Python.

Comments (1)

  1. Log in to comment