has wrote:
> Brendan Simon (eTRIX) wrote:
> 
>> I have an OS X python program that is invoked via a uri on a webpage --
>> eg. "myapp:command"
>>
>> The app is invoked fine (via the plist), but I can't seem to extract the
>> "command" from the system args.  sys.argv contains the name of the
>> application and some other values.
>> example:
>>   sys.argv[0] = 'myapp
>>   sys.argv[1] = '-psn_0_22123800'
>>
>>
>> How can I my program read the _uri_ that caused the program to be
>> invoked.
> 
> You need to install an Apple event handler that responds to the GetURL
> event. Various ways you can do that, depending on whether your Python
> application is Carbon or Cocoa based, has an event loop or runs in batch
> mode, uses argvemulation, etc. For more specific advice, provide more
> details.

I'm using wxPython.

I think setting argvemulation to True may be the key.  I commented it
out when adding the plist option as I didn't know the correct way to add
to the setup options.

DATA_FILES = []
OPTIONS = {'argv_emulation': True}

URLTYPES=[ { 'CFBundleURLName' : "MyApp", 'CFBundleURLSchemes' : [
"myapp" ] } ]

setup(
    app=APP,
    data_files=DATA_FILES,
    #options={'py2app': OPTIONS},
    options=dict(py2app=dict(
        plist=dict(
            CFBundleURLTypes=URLTYPES,
        ),
    )),

    setup_requires=['py2app'],
)

I will play around and see how I go.

Thanks, Brendan.
begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to