On 3/15/11 6:11 AM, Ronald Oussoren wrote:
Once deployed as .app using py2app, I am not getting all the env vars that are
available to users.

That's on OSX issue, and not a problem in py2app.  Most of the environment 
variables you see from the command-line are initialized by the shell and/or 
Terminal.app and are not available to GUI applications. You'd see the same 
issue with a native application.

Indeed, and we did explain that to the OP on the wxPython list.

However, it seems that it is fairly common that folks write applications that call command line utilities. In this case, they need the environment to be set up the way that it is in the user's default shell. I suggest that it might be nice to have an option for py2app to build an app that will initialize the environment that a user would see in their standard shell.

Thanks to a suggestion by Robin Dunn, the OP has found a solution, in which the start up app is replaced by a shell script that then calls exec to start up the actual app -- this assures that the shell is initialized, and the environment passed on to the app itself:

#!/bin/bash
DIR=$(dirname "$0")
exec $DIR/launch

I don't know if that's a robust way to do it or not. If nothing else, it assumes that the user's default shell is bash, which is common, but not guaranteed.

so:

1) is there a better way to accomplish this task?

2) if so, does it make sense to built it into py2app as an option?


-Chris


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to