[Pythonmac-SIG] How to create a desktop alias to run a python file?
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
>>> /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/
>>> 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:
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
Why not use the "build applet" utility that comes with the MacPython
distribution? That's what I used when I was packaging SPE.
Code by Kevin
More information about the Pythonmac-SIG