[Pythonmac-SIG] How to make 2 scripts in one application

Dethe Elza delza at livingcode.org
Mon Mar 5 18:02:48 CET 2007

On 5-Mar-07, at 4:45 AM, Chris Van Bael wrote:

> Hi all,
> doesn't anybody have an idea on how to solve this issue?

Sorry, didn't see your original post.

You can address the python instance in the application bundle (which  
will use the modules in the application bundle), but I think you'll  
need to know the path the the application.  If the application will  
always be in /Applications/ then you're good to go, otherwise you'll  
need to have another way to find the Application location (there are  
several, how you do this depends on several things I don't know about  
your deployment environment).

For instance, I have an application named "Drawing Board" in my / 
Applications directory, that was build using py2app.  I can invoke  
the python embedded in it with the path:

/Applications/Drawing\ Board.app/Contents/MacOS/python

So if my script starts with

#!/Applications/Drawing\ Board.app/Contents/MacOS/python

then it will run using that version of Python by default and have  
access to any libraries I've included with my application.

Does that answer your question?


> Thanks,
> Chris
> On 2/27/07, Chris Van Bael <chris.van.bael at gmail.com> wrote:
>> Hi all,
>> Maybe a totally noob question, but I'll ask it anyway since I  
>> couldn't
>> find an answer on the series of tubes...
>> I'm working on a pygame program that runs on Linux, Windows and Mac.
>> It uses an database which it accesses through SQLAlchemy.
>> So on Linux in setup.py we have a section to install the program and
>> create that database.
>> Now on Windows with py2exe I have a setup.py which has a console  
>> and a
>> windows script.
>> The windows script runs the program and the console script sets up  
>> the database.
>> Since I use no library.zip file, this can also access the  
>> SQLAlchemy modules.
>> Now I want to do something similar to that for OSX.
>> I cannot run the script with the python installed on OSX because it
>> needs SQLAlchemy.
>> But the modules I need are somewhere in the application bundle, can I
>> use them somehow?
>> Greets,
>> Chris
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

Things fall apart.  The Centre cannot hold.  -- W. B. Yeats

More information about the Pythonmac-SIG mailing list