[Pythonmac-SIG] Newbie question: py2app does only include main .py file, not the rest.

Christopher Barker Chris.Barker at noaa.gov
Wed Dec 9 23:50:08 CET 2009


Search this list and you'll a number of good discussions of py2app, but 
a few hints:

1) use the latest version:

easy_install py2app==dev

(at least I think that's the syntax)

> generates an App Bundle, but in the Contents/Resources directory
> only the main .py file is created, not all other .py files
> from the application.

There should be a "lib" dir in Resources that has most of the python 
code in it -- look in theree. Also, most of the python modules get put 
in a single zip archive, which you can unzip to see what's there.

> If I copy those in manually I get:

If you put them directly in Resources, I'm not sure they'll be found, 

> ImportError: No module named pkg_resources.

That's a setuptools module -- eggs and setuptools are not supported well 
by py2app, though I can usually get it to work. Make sure none of your 
eggs are zipped -- that can be a problem.

> Now I'm at a loss how to continue. What should I do next?

Back up a step, and use py2app to build a simple app first. If that 
works, try adding stuff in bit my bit. If that's too hard to do, then 
you can built your entire app, run it, and then each time you get an 
error, you can add the missing package manually to the setup.py script. 
It's a bit slow going, but you'l get there.

You can also look in the app bundle, and unzip the site-packages.zip to 
see what is there, and what's missing.

adding a "print sys.path" can be helpful too -- stdout goes to the 
Console app, so you can see it.



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Pythonmac-SIG mailing list