Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > py2app semi-standalone semi-works

Reply
Thread Tools

py2app semi-standalone semi-works

 
 
James Stroud
Guest
Posts: n/a
 
      10-04-2006
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
 
Reply With Quote
 
 
 
 
Dave Opstad
Guest
Posts: n/a
 
      10-04-2006
In article <ulMUg.13149$(E-Mail Removed) >,
James Stroud <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
James Stroud
Guest
Posts: n/a
 
      10-04-2006
Dave Opstad wrote:
> In article <ulMUg.13149$(E-Mail Removed) >,
> James Stroud <(E-Mail Removed)> 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]"

>
> 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems using py2app Richard Taylor Python 0 10-10-2005 10:53 AM
py2app and Bittornado bsharitt@gmail.com Python 3 08-30-2005 11:54 PM
OS X py2app confusion bex Python 1 07-25-2005 08:50 PM
py2app can't find boot_app.py Bob Swerdlow Python 0 03-14-2005 07:16 PM
py2app on Mac OS X 10.3 Austin Python 1 12-31-2004 11:26 AM



Advertisments