472,141 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

py2app semi-standalone semi-works

Hello All,

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.

James
Oct 4 '06 #1
2 2222
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]"

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
Oct 4 '06 #2
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/
Oct 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Austin | last post: by
reply views Thread by Bob Swerdlow | last post: by
1 post views Thread by bex | last post: by
3 posts views Thread by bsharitt | last post: by
3 posts views Thread by SPE - Stani's Python Editor | last post: by
2 posts views Thread by loren.davie | last post: by
reply views Thread by Pierre Thibault | last post: by
reply views Thread by Russell E. Owen | last post: by
3 posts views Thread by AdamGr | last post: by
1 post views Thread by Joe Strout | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.