[Pythonmac-SIG] py2app run errors

William Kyngesburye woklist at kyngchaos.com
Fri Aug 11 16:41:49 CEST 2006


On Aug 10, 2006, at 6:46 PM, Bob Ippolito wrote:

>> Well, some progress.  I switched back to the spawn method - I  
>> didn't realize that the args behaves exactly like in exec, where  
>> the command and name (argv[0]) are repeated.  I was doing spawnlp 
>> ('open', '-a', 'Terminal.app', shellrun).  So, now I have spawn  
>> finally opening the shell file in a new Terminal window.
>>
>> Now the environment vars aren't making it into the Terminal  
>> window.  I guess that makes sense - the environment set by spawn/ 
>> exec is for the command it's running, 'open', not the file that  
>> open is telling Terminal to open.  I can't use that egginstaller  
>> method of writing a script, this application will likely be  
>> running without admin privileges, so wouldn't be able to write to  
>> the app package.
>
> You should never write to the app package.

That's why I didn't like the method, but...

> In any case, the example I sent you writes a temporary file. Look a  
> bit harder.
>
... yeah, I missed that bit - I saw just the parts I immediately  
understood.

Anyways, better idea: the shell script is a bootstrap for the  
software - it sets a fixed root path as configured at build time and  
starts another script, the main command shell of the app.  I added a  
test for the env var for when it's started from a Mac app package, so  
it could set the root path dynamically.  I originally did this with  
an OnMyCommand droplet.

Since I already changed the script, I decided to make it Mac-only and  
let the script figure out the root path.  No Mac test needed, no env  
vars needed from the python startup.  The py2app setup will install  
this copy of the startup shell instead of the one from the software.   
Bonus of less to change in the original software source.

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole.  Now what  
does that remind me of?  Ah, yes - life."

- Marvin



More information about the Pythonmac-SIG mailing list