[Twisted-Python] Twisted plugins and py2exe

Jean-Paul Calderone exarkun at divmod.com
Tue Feb 24 09:55:27 MST 2009


 Tue, 24 Feb 2009 17:35:14 +0100, Gabriel Rossetti <gabriel.rossetti at arimaz.com> wrote:
>Jean-Paul Calderone wrote:
>>On Tue, 24 Feb 2009 11:49:13 +0100, Gabriel Rossetti 
>><gabriel.rossetti at arimaz.com> wrote:
>>>Hello everyone!
>>>
>>>I used py2exe on a Twisted app of mine and I get this exception :
>>>
>>>
>>>Traceback (most recent call last):
>>>  File "proj\service.pyc", line 1308, in connectionMade
>>>
>>>  File "proj\service.pyc", line 1640, in _register
>>>
>>>  File "proj\service.pyc", line 504, in loadPlugins
>>>
>>>  File "twisted\plugin.pyc", line 200, in getPlugins
>>>
>>>--- <exception caught here> ---
>>>  File "twisted\plugin.pyc", line 179, in getCache
>>>
>>>exceptions.AttributeError: ZipPath instance has no attribute 'setContent'
>>>
>>>Has anyone ever had this problem while using plugins with Twisted and 
>>>py2exe?
>>
>>No, but from the traceback, it seems fairly clear that the plugin system
>>is trying to write a plugin cache file into your py2exe-created zip file
>>of Python source.  This won't work, of course.  You could try making sure
>>the cache file is up to date and including it in the zip file, but I have
>>no idea if this will actually produce sensible behavior.  The other
>>possibility is to actually teach the plugin system about zip files (ie,
>>contribute a patch to Twisted to support this case).
>>
>>Jean-Paul
>Ok, I could do this, teach it abot zip files and have it update it's cache 
>in the zip file, but in certain cases, like mine actually, if you tell 
>py2exe to include the zip file in the exec, then it won't work. How about 
>adding the possibility to specify where the cache is to be written?

Updating the cache in the zip file probably isn't the right thing to do.
Just skipping cache generation would probably make more sense.  It should
be easier to implement, anyway.

As far as I can tell, it doesn't make sense to allow the cache location to
be specified as configuration, though.  Skipping cache file generation should
be fine.

Jean-Paul




More information about the Twisted-Python mailing list