[Pythonmac-SIG] py2app run errors

Bob Ippolito bob at redivi.com
Fri Aug 11 01:46:53 CEST 2006


On Aug 10, 2006, at 4:24 PM, William Kyngesburye wrote:

> On Aug 10, 2006, at 5:26 PM, Bob Ippolito wrote:
>
>> argv[0] and the name of the script aren't necessarily the same thing.
>> __file__ is the file of the script (all modules have a __file__
>> attribute).
>>
> Like I said, just getting my feet wet.
>
>>>>> os.execlp('open', 'open', '-a', 'Terminal.app', shellrun)
>>>>
>>>> Probably should specify /usr/bin/open instead of just open.
>>>>
>>> Same error (changed command to os.execl).
>>
>> What you really should do at this point is print out your environment
>> variables to make sure they're the right thing. If the environment
>> variables aren't the problem, then you probably forgot to include the
>> shell script in your app.
>>
>> When I want to open something in Terminal I generate a temporary
>> script on the fly, rather than having some static script with
>> parameters wedged in with environment variables. There's even an
>> example of this technique in the py2app source:
>>
>> http://svn.pythonmac.org/py2app/py2app/trunk/examples/EggInstaller/ 
>> EggInstaller.py
>>
> 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. In any case, the example I  
sent you writes a temporary file. Look a bit harder.

-bob





More information about the Pythonmac-SIG mailing list