Dave Opstad wrote:
In article <ul******************@newssvr27.news.prodigy.net >,
James Stroud <js*****@mbi.ucla.eduwrote:
>>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]"
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
Hi Dave,
Thank your for pointing me to setup.cfg. I make standalones for windows,
linux, and OS X, so it will definitely help take some of the confusion
out of my setup.py.
However, when passing trying to build semi-standalone, the module does
make it into the application bundle, but the python interpreter doesn't
seem to know where to find it. Is there something I can specify in
setup.cfg or setup.py that will point the interpreter to the included
module, or will I need to make another test and programmatically set
sys.path inside of my python code? If this is solved by setup.cfg, then
forgive me--I haven't had a chance to try it yet.
Below is the relevant part of my setup.py.
James
=====
APP = ['%s.py' % appname]
DATA_FILES = []
OPTIONS = {
'argv_emulation' : True,
'strip' : True,
'packages' : packages,
'iconfile' : '%s.icns' % appname,
}
if not os.path.exists('dist'):
setup(
app=APP,
name=appname,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
else:
print 'Directory "dist" exists. Doing nothing.'
=====
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/