A py2app-built application stopped building properly recently after 
various upgrades. It would fail immediately on startup complaining that 
it could not find zope.interface. The app uses Twisted, which is why it 
needs zope.interface.

I tried adding "zope" or "zope.interface" to "packages", but neither 
worked (in particular, the latter resulted in a traceback during the 
build).

What did work was to add a blank __init__.py file to the "zope" 
directory in site-packages. But I don't know why that was useful. (I 
realize it makes zope into a package, but I don't know why that was 
necessary because zope.interface can already be imported from the 
command line -- presumably due to a pth file).

Details are given below.

-- Russell

Details

Python 2.6, py2app 0.4.3, zope.interface 3.6.1 and Twisted 10.0.0.

zope.interface is installed as follows (contents of site-packages):
zope/
zope/interface/
zope.interface-3.6.1-py2.6-nspkg.pth 
zope.interface-3.6.1-py2.6.egg-info/

If I add a blank
zope/__init__.py
then the py2app-built application runs properly.


zope.interface-3.6.1-py2.6-nspkg.pth  contains:

import sys,new,os; p = 
os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',)); ie = 
os.path.exists(os.path.join(p,'__init__.py')); m = not ie and 
sys.modules.setdefault('zope',new.module('zope')); mp = (m or []) and 
m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)

I don't use easy_install (I installed zope.interface with pip), so 
easy_install.pth doesn't contain any zope info. For completeness, here 
is what it has:
import sys; sys.__plen = len(sys.path)
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = 
p+len(new)

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to