[Pythonmac-SIG] sys.argv in applications (was: BundleBuilder help ?)

Jack Jansen Jack.Jansen at cwi.nl
Tue Dec 9 07:36:10 EST 2003


On 9 Dec 2003, at 4:16, Kevin Ollivier wrote:

> Hi Steven,
>
> Looking at the bitpim source, my guess is that this line is causing  
> the problem:
>
> resourcedirectory=os.path.abspath(os.path.join(os.path.dirname(sys.argv 
> [0]), 'resources'))
> Using sys.argv like this can cause problems on OS X, which sends some  
> extra args in when launched from the Finder.

The finder adds a new sys.argv[1], the -psn business, but sys.argv[0]  
should be fine. Here's the output from a simple application that dumps  
sys.argv:

Hello, sys.argv=  
['/Users/jack/tmp/build/hello.app/Contents/Resources/hello.py',  
'-psn_0_2228225']

The bundlebuilder bootstrap code tries to put decent values into  
sys.argv, so if it fails to do this in certain circumstances please  
file a bug report...
--
Jack Jansen        <Jack.Jansen at cwi.nl>        http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman




More information about the Pythonmac-SIG mailing list