[Pythonmac-SIG] Launching Python Subprocesses with Py2App

Bob Swerdlow rswerdlow at goombah.com
Fri Apr 29 15:37:46 CEST 2005


Hi,
I am upgrading our application from bundlebuilder to py2app.  It looks great 
and it looks like it will run on Tiger, which my bundlebuilder version does 
not.

However, I've run into a problem because our application launches 
subprocesses to run other Python scripts.  In the old version with 
bundlebuilder, sys.executable was in the same location as the Resources, so 
we used that path to find the file containing the main script for the new 
process and then used subprocess.POpen to launch sys.executable with that 
path as an argument.  This does not work with py2App because sys.executable 
is no longer in the same place as the other files and the modules are 
compressed into site-packages.zip.

I found the FAQ on how to locate the bundle resources, but the files that I 
want python to run cannot be accessed from the command line (since it is in 
site-packages.zip).  I tried adding a copy of the main script for one of the 
new process as a 'resource', and I can launch it, but site-packages.zip is 
not in its PYTHONPATH and so it cannot find the other modules it needs.

So, the question is, how do I configure my code using py2app so that I can 
launch a subprocess that runs one of the python scripts embedded in the 
bundle?

Thanks for your help!
Bob 




More information about the Pythonmac-SIG mailing list