Opened 5 years ago

Last modified 20 months ago

#3985 defect new

ZipPath instance has no attribute 'setContent'

Reported by: truekonrads Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: truekonrads, zooko@…, tobias.oberstein@… Branch:
Author: Launchpad Bug:

Description

Traceback when running trial on twisted.

import pkg_resources
Traceback (most recent call last):
  File "C:\Documents and Settings\Konrads\My Documents\Twisted\twisted\python\usage.py", line 241, in parseOptions
    self.postOptions()
  File "C:\Documents and Settings\Konrads\My Documents\Twisted\twisted\scripts\trial.py", line 293, in postOptions
    self['reporter'] = self._loadReporterByName(self['reporter'])
  File "C:\Documents and Settings\Konrads\My Documents\Twisted\twisted\scripts\trial.py", line 279, in _loadReporterByName
    for p in plugin.getPlugins(itrial.IReporter):
  File "C:\Documents and Settings\Konrads\My Documents\Twisted\twisted\plugin.py", line 200, in getPlugins
    allDropins = getCache(package)
--- <exception caught here> ---
  File "C:\Documents and Settings\Konrads\My Documents\Twisted\twisted\plugin.py", line 179, in getCache
    dropinPath.setContent(pickle.dumps(dropinDotCache))
exceptions.AttributeError: ZipPath instance has no attribute 'setContent'

Platform is Twisted HEAD as of Aug 28/09, Win32, Python 2.6,

Change History (8)

comment:1 Changed 5 years ago by exarkun

This doesn't always happen when running trial twisted on Windows. Presumably this has something to do with there being a zip file on the import search path. Can you please verify this? Ideally, describe the execution environment in sufficient detail that someone else can reproduce the behavior.

comment:2 Changed 5 years ago by truekonrads

  • Cc truekonrads added

Here is my sys.path, it has some .zip files:

C:\Python26\Lib\idlelib
C:\Python26\lib\site-packages\setuptools-0.6c9-py2.6.egg
C:\Python26\lib\site-packages\django-1.1_beta_1-py2.6.egg
C:\Python26\lib\site-packages\django_authopenid-1.0.1-py2.6.egg
C:\Python26\lib\site-packages\django_registration-0.7-py2.6.egg
C:\Python26\lib\site-packages\python_openid-2.2.4-py2.6.egg
C:\Python26\lib\site-packages\epydoc-3.0.1-py2.6-win32.egg
C:\Python26\lib\site-packages\docutils-0.5-py2.6.egg
C:\Python26\lib\site-packages\beautifulsoup-3.1.0.1-py2.6.egg
C:\Python26\lib\site-packages\nevow-0.9.33_r17222-py2.6.egg
C:\Python26\lib\site-packages\simplejson-2.0.9-py2.6-win32.egg
C:\WINDOWS\system32\python26.zip
C:\Python26\DLLs
C:\Python26\lib
C:\Python26\lib\plat-win
C:\Python26\lib\lib-tk
C:\Python26
C:\Python26\lib\site-packages
C:\Python26\lib\site-packages\PIL
C:\Python26\lib\site-packages\win32
C:\Python26\lib\site-packages\win32\lib
C:\Python26\lib\site-packages\Pythonwin

comment:3 Changed 4 years ago by zooko

  • Cc zooko@… added

This happened to me:

warning: build_py: byte-compiling is disabled, skipping.

running trial
running build_ext
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/python/usage.py", line 241, in parseOptions
    self.postOptions()
  File "/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/scripts/trial.py", line 295, in postOptions
    self['reporter'] = self._loadReporterByName(self['reporter'])
  File "/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/scripts/trial.py", line 281, in _loadReporterByName
    for p in plugin.getPlugins(itrial.IReporter):
  File "/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/plugin.py", line 199, in getPlugins
    allDropins = getCache(package)
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg/twisted/plugin.py", line 178, in getCache
    dropinPath.setContent(pickle.dumps(dropinDotCache))
exceptions.AttributeError: ZipPath instance has no attribute 'setContent'

I have some zip files (.eggs) on my sys.path:

HACK ubuntu-9:~/playground/tahoe-lafs/trunk$ python -c 'import sys;print sys.path'
['', '/usr/local/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/site-packages/zope.interface-3.6.1-py2.7-linux-x86_64.egg', '/usr/local/lib/python2.7/site-packages/pyutil-1.7.12-py2.7.egg', '/usr/local/lib/python2.7/site-packages/zbase32-1.1.2-py2.7.egg', '/usr/local/lib/python2.7/site-packages/argparse-1.1-py2.7.egg', '/usr/local/lib/python2.7/site-packages/darcsver-1.6.0-py2.7.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/Twisted-10.1.0-py2.7-linux-x86_64.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/zope.interface-3.6.1-py2.7-linux-x86_64.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/pyutil-1.7.12-py2.7.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/zbase32-1.1.2-py2.7.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/argparse-1.1-py2.7.egg', '/usr/local/stow/python2.7/lib/python2.7/site-packages/darcsver-1.6.0-py2.7.egg', '/usr/local/lib/python2.7/site-packages', '/home/zooko/lib/python2.7/site-packages', '/usr/local/stow/python2.7/lib/python27.zip', '/usr/local/stow/python2.7/lib/python2.7', '/usr/local/stow/python2.7/lib/python2.7/plat-linux2', '/usr/local/stow/python2.7/lib/python2.7/lib-tk', '/usr/local/stow/python2.7/lib/python2.7/lib-old', '/usr/local/stow/python2.7/lib/python2.7/lib-dynload', '/usr/local/stow/python2.7/lib/python2.7/site-packages', '/home/zooko/lib/python2.7/site-packages']

comment:4 Changed 4 years ago by <automation>

  • Owner glyph deleted

comment:5 Changed 20 months ago by oberstet

I am running into this on Twisted 13.0 / Python 2.7 also:

    [ec2-user@ip-10-32-20-101 ~]$ twistd -n webmq -a $HOME/appdata
    Unexpected error while writing cache file
    Traceback (most recent call last):
      File "/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 614, in parseOptions
        usage.Options.parseOptions(self, options)
      File "/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/python/usage.py", line 261, in parseOptions
        for (cmd, short, parser, doc) in self.subCommands:
      File "/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/application/app.py", line 631, in subCommands
        for plug in sorted(plugins, key=attrgetter('tapname')):
      File "/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/plugin.py", line 209, in getPlugins
        allDropins = getCache(package)
    --- <exception caught here> ---
      File "/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/plugin.py", line 181, in getCache
        dropinPath.setContent(pickle.dumps(dropinDotCache))
    exceptions.AttributeError: 'ZipPath' object has no attribute 'setContent'
    ...

The twistd plugin will run further, depsite above traceback. This is on my sys.path:

/home/ec2-user/app/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/autobahn-0.5.14-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg
/home/ec2-user/app/lib/python2.7/site-packages/zope.interface-4.0.5-py2.7-linux-x86_64.egg
/home/ec2-user/app/lib/python2.7/site-packages/webmq-0.6.17-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/Flask_Markdown-0.3-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/Flask-0.9-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/Markdown-2.2.0-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/webmqcommon-0.2.0-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/tldextract-1.1.1-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/isodate-0.4.9-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/netaddr-0.7.6-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/pycrypto-2.6-py2.7-linux-x86_64.egg
/home/ec2-user/app/lib/python2.7/site-packages/pyOpenSSL-0.13-py2.7-linux-x86_64.egg
/home/ec2-user/app/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg
/home/ec2-user/app/lib/python2.7/site-packages/cx_Oracle-5.1.2-py2.7-linux-x86_64.egg
/home/ec2-user/app/lib64/python27.zip
/home/ec2-user/app/lib64/python2.7
/home/ec2-user/app/lib64/python2.7/plat-linux2
/home/ec2-user/app/lib64/python2.7/lib-tk
/home/ec2-user/app/lib64/python2.7/lib-old
/home/ec2-user/app/lib64/python2.7/lib-dynload
/usr/lib64/python2.7
/usr/lib/python2.7
/home/ec2-user/app/lib/python2.7/site-packages

This is on CPython / Amazon Linux:

[ec2-user@ip-10-32-20-101 ~]$ uname -a
Linux ip-10-32-20-101 3.4.37-40.44.amzn1.x86_64 #1 SMP Thu Mar 21 01:17:08 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user@ip-10-32-20-101 ~]$ python
Python 2.7.3 (default, Mar 14 2013, 09:35:09)
[GCC 4.6.2 20111027 (Red Hat 4.6.2-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

comment:6 Changed 20 months ago by oberstet

  • Cc tobias.oberstein@… added

comment:7 Changed 20 months ago by oberstet

This is strange: the only ZIP file on sys.path does not even exist:

>>> f = "/home/ec2-user/app/lib64/python27.zip"
>>> f in sys.path
True
>>> os.path.exists(f)
False
>>>

How did it get there? How can I remove it? Why does ZipFile break in this case? Mmh .. any hints?

comment:8 Changed 20 months ago by oberstet

Probably the python27.zip which is on sys.path but does not exist in the filesystem is the pseudo element described http://stackoverflow.com/questions/6948779/missing-c-windows-system32-python27-zip-file/6949048#6949048.

Sym linking

ln -s /usr/lib64/libpython2.7.so.1.0 /home/ec2-user/app/lib64/python27.zip

does not help though.

Note: See TracTickets for help on using tickets.