py2app semi-standalone semi-works

Dave Opstad dave.opstad at monotypeimaging.com
Wed Oct 4 10:56:12 EDT 2006


In article <ulMUg.13149$7I1.6975 at newssvr27.news.prodigy.net>,
 James Stroud <jstroud at mbi.ucla.edu> wrote:

> I am trying to create a semi-standalone with the vendor python on OS X 
> 10.4 (python 2.3.5). I tried to include some packages with both 
> --packages from the command and the 'packages' option in setup.py. While 
> the packages were nicely included in the application bundle in both 
> cases (at Contents/Resources/lib/python2.3/), they were not found by 
> python when the program was launched, giving the error:
> 
>      "ImportError: No module named [whatever module]"
> 
> Is this because semi-standalone is semi-broken or is it because I have 
> semi-omitted something?
> 
> Any advice on resolving this issue would be greatly appreciated and 
> would greatly reduce the size of the download.

You might want to have a setup.cfg file in addition to the setup.py 
file. I've found that helps ensure the relevant packages and includes 
make it into the bundled application.

For example, say you have a package named fred and also a separate 
module named george that are needed for your app. Your setup.cfg could 
look like this:

#
# setup.cfg
#

[py2app]
packages=fred
includes=george

You can also have a section for [py2exe] if needed; that way, if there 
are modules that your Windows build needs that the Mac build doesn't (or 
vice versa), you can just include them where needed.

Dave



More information about the Python-list mailing list