[Pythonmac-SIG] How to create a desktop alias to run a python file?
Kent Quirk
kent_quirk at cognitoy.com
Fri Mar 23 13:39:51 CET 2007
Jack Jansen wrote:
> On 20-mrt-2007, at 17:30, Alfred Morgan wrote:
>
>> From: Stani's Python Editor <spe.stani.be at gmail.com >
>> This is probably very easy, but I don't find how to do it. I want to
>> execute this command if an user clicks on the icon of the alias on the
>> desktop:
>>
>> /usr/bin/pythonw path/gui.pyw
>>
>> Like other people said, you probably don't want to do that, but
>> unlike other people, I'll answer your question.
>>
>> mkdir ~/Desktop/MyProg.app
>> echo '#!/usr/bin/env pythonw /path/gui.pyw' > ~/Desktop/MyProg.app/
>> MyProg
>> chmod +x ~/Desktop/MyProg.app/MyProg
>>
>> double click MyProg on the desktop and it should launch your python
>> program using pythonw
>>
>
> I was very surprised when I saw this, I'd never seen this before.
>
> And, indeed, when I tried it it didn't work:-(
> Maybe you skipped an important step in the instructions?
>
Isn't it the case that you'd have to actually conform to the Apple
bundle format, including the Contents directory, a plist, and so forth?
If you're going to go through the pain, why not just use py2app, which
does it for you?
But if you really want to figure it out, here's the documentation:
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/Concepts/BundleAnatomy.html
Kent
More information about the Pythonmac-SIG
mailing list