[Pythonmac-SIG] How can I include command line arguments in bundled apps?

Peter Steiner unistein at gmx.ch
Mon Oct 4 17:19:02 CEST 2004


Am 04.10.2004 um 16:53 schrieb Glenn Andreas:

> At 4:45 PM +0200 10/4/04, Peter Steiner wrote:
>>  Double-clicking in the Finder does not work; console.log has the 
>> following:
>>
>>> Error: option -p not recognized
>>>
>>> USAGE: idle  [-deins] [-t title] [file]*
>>> ...(rest skipped)
>>
>> Regards, Peter
>
> Anything doubleclicked from the Finder gets a "-psn" options in the 
> command line (which specifies the process serial number, though it's 
> unclear exactly what that is needed for)

Apparently the __argvemulator_idle parameter takes care of the 
-psn_xxxxx option, but not if there are other options inbetween. 
Rearranging the sys.argv manipulation helped:

> sys.argv.insert(1, mainprogram)
> sys.argv.insert(1, "-Qnew")
> sys.argv.append("-n")

Short summary (correct me if I'm wrong)
- options for python itself should go to the front of sys.argv
- options for the invoked python program should go the the end of 
sys.argv
- inbetween argvemulator is doing some magic with Finder supplied 
arguments

Regards and thanks for the quick help!

Peter
-- 
Peter Steiner <unistein at gmx.ch>         PGP-ID 0x02850F53 (DH/DSS)
PGP Fingerprint 68AB D08E D995 41B4 C6FD  639D 9B94 D249 0285 0F53



More information about the Pythonmac-SIG mailing list