[Pythonmac-SIG] Problems with finding standard python modules when using py2app

Jens Thomas j.m.h.thomas at dl.ac.uk
Thu May 10 16:01:16 CEST 2007


Hi,

I'm trying to building an app using py2app for my Python application and 
have managed to fall at the first hurdle.

I added the following to my setup.py file (which works fine with py2exe 
and so should be in reasonably good shape):

from setuptools import setup

app=["viewer/main.py"],
setup_requires=["py2app"],
options={'py2app': {'argv_emulation': True}}

I created the bundle with "python setup.py py2app" and then tried 
running it from the finder and got:

'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 103, in ?
    _argv_emulation()
  File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 101, in 
_argv_emulation
    _get_argvemulator().mainloop()
  File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 7, in 
_get_argvemulator
    import traceback
ImportError: No module named traceback
2007-05-10 14:18:18.089 ccp1gui[16632] ccp1gui Error
2007-05-10 14:18:18.090 ccp1gui[16632] ccp1gui Error
An unexpected error has occurred during execution of the main script

ImportError: No module named traceback


I tried removing the line:

options={'py2app': {'argv_emulation': True}}

from setup.py, but this this time the program failed with:

'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 4, in ?
    _chdir_resource()
  File "/tmp/ccp1gui.app/Contents/Resources/__boot__.py", line 2, in 
_chdir_resource
    import os
ImportError: No module named os
2007-05-10 14:38:14.717 ccp1gui[17411] ccp1gui Error
2007-05-10 14:38:14.717 ccp1gui[17411] ccp1gui Error
An unexpected error has occurred during execution of the main script

ImportError: No module named os


Is there anything daft that I'm doing that's causing it to go wrong 
before it's even got out of the blocks?

For info I'm running under Darwin 8.9.1 on an Intel Mac, using 
setuptools 0.6c5 and the standard framework python (2.3).

I notice that there was a similar bug mentioned on the mailing list, but 
that was for programs started from a directory containing a colon, 
whereas this is run from /tmp

Best wishes,

Jens

  



More information about the Pythonmac-SIG mailing list