[Pythonmac-SIG] How to create a desktop alias to run a python file?
Kevin Walzer
kw at codebykevin.com
Fri Mar 23 14:44:53 CET 2007
Kent Quirk wrote:
> 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
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>
Why not use the "build applet" utility that comes with the MacPython
distribution? That's what I used when I was packaging SPE.
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
More information about the Pythonmac-SIG
mailing list