On 12/03/11 10:00 PM, pythonmac-sig-requ...@python.org wrote:
> On 10 Mar, 2011, at 18:04, Brendan Simon (eTRIX) wrote:
>> > Below is my patch to get URLs/URIs to be added to sys.argv when an app
>> > is opened via the Launcher.
>> > 
>> > It should be applied to:
>> > 
>> > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app/bootstrap/argv_emulation.py
>> > 
>> > Can this patch *please* be integrated (please modify if necessary) in to
>> > 0.5.3 release !!
> Which OS release are you on? I've tried to test with python 2.5 and 2.7 on 
> OSX 10.6 and those seem to work fine without your patch (even with the 
> lowercase values you mention furtheron).
>
> My test has a simple main.py script that saves sys.argv in a text file. When 
> I add that file to an application bundle with py2app and then start the 
> bundle with 'open -a dist/myapp.app file:/usr/bin/ssh' the saved argv 
> contains the file to open. As code says more than my description I've 
> attached the unittest testcase I've tried.
>
> Is this test testing the failure your reporting or did I misread your message?

I am running on OS 10.6, but my app needs to run on 10.4, 10.5 and 10.6
(PPC and Intel).
I am using Python 2.5.4.

I don't think your test would work if you were to use a custom url,
rather than 'file:' and a filename/path.

If I ran the command "open myurl:mycommand" from the terminal, and my
plist has configured 'myurl' as a recognised url, then the app bundle
should fire up.  It may need to be in the Application folder for it to
work ??

I expect 'myurl:mycommand' to be appended to sys.argv.

Here is a snippet of my py2app setup.py.

# A custom plist for letting it associate with a URL protocol.
URLTYPES = [
             {
               'CFBundleURLName' : "MyUrl",
               'CFBundleURLSchemes' : [ "myurl" ]
             }
           ]

Plist = dict(
                NSAppleScriptEnabled = 'YES',
                CFBundleIdentifier = 'com.myurl',
                LSMinimumSystemVersion = "10.4",
                CFBundleURLTypes = URLTYPES
            )

OPTIONS = {
            'argv_emulation' : True,
            'iconfile' : 'images/myurl.icns',
            'plist' : Plist,
           }

Hope that helps,
Brendan.

_______________________________________________
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