473,415 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,415 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 2301
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Austin | last post by:
""" Minimal setup.py example, run with: % python setup.py py2app """ from distutils.core import setup import py2app setup( app = , )
0
by: Bob Swerdlow | last post by:
I'm trying to move my application from bundlebuilder to py2app. I upgraded to PyObjC 1.2, which include py2app 1.7, but I got the following error. I saw a note on the py2app site that earlier...
1
by: bex | last post by:
Im baffled about this one... Im running OS 10.3, and Python 2.3. I installed py2app 0.17 and never used it, then installed py2app 0.2. It refuses to work. None of the samples will build....
3
by: bsharitt | last post by:
I'm trying to get Bittornado to run on Mac OS X (10.4 with Python 2.3.5) but I've only ever dealt with Python at lower lever scripting stuff, never wxPython or another GUI stuff. py2app is supposed...
3
by: SPE - Stani's Python Editor | last post by:
Hi, I'm creating a GUI program with wxPython which will be distributed for Mac and Windows. The audience of the program is not technical at all (eg they've never heard about Python yet ;-), so...
2
by: loren.davie | last post by:
Hi, I'm attempting to build a small app that uses pythoncard for a gui layer. The intention is to use py2app to construct an .app bundle for the Mac. I'm running OS 10.4 on an Intel MacBook...
0
by: Pierre Thibault | last post by:
Hello, I am unable to use py2app. I have an error when I try to import it: ImportError: No module named py2app I have installed pyobjc-1.3.7. I am on Mac OS 10.4.6. It does not work. It...
0
by: Russell E. Owen | last post by:
I was using an older version of py2app to distribute an application. This placed the python library code in TUI.app/Contents/Resources/Python I just upgraded to py2app 0.3.5 and now I find the...
3
by: AdamGr | last post by:
I am currently trying to convert a program I just wrote to application form, on the Mac. I'm using py2app to accomplish this, and everything works fine up until the last stage; when I try to complete...
1
by: Joe Strout | last post by:
I'm trying to use py2app to convert the pySketch wxPython example into a stand-alone OS X app. I've found the documentation at <http://undefined.org/python/py2app.html like this: #!/usr/bin/env...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.