[Pythonmac-SIG] How to create a desktop alias to run a python file?

Alfred Morgan alfred at 54.org
Fri Mar 23 22:27:01 CET 2007

On 3/23/07, Jack Jansen <Jack.Jansen at cwi.nl> wrote:
> I was very surprised when I saw this, I'd never seen this before.

It's true, This is not the "proper" use of app framework but it was quick
and dirty and worked for me. I don't like the answer "just drop it in this
magic box and it will just work".  It was mostly to prove a point that you
don't need py2app just to solve the simple problem at hand (especially when
py2app isn't working for people).

And, indeed, when I tried it it didn't work:-(
> Maybe you skipped an important step in the instructions?

Hmm, I am interested in knowing why it didn't work.  I am running on
10.4.9using python
2.4 Framework.
Note: there are some unwanted arguments passed to the python program using
the method I presented

Here is a shell script I ran on several other os x installations so there is
no doubt it will work and there are no missing steps.  It basically creates
a python program in /tmp/alfred_hw.py then creates alfred_hw application on
the desktop so you can double click it and a window pops up with Hello

cat > /tmp/alfred_hw.py << .
from Tkinter import Tk, Label
Label(r, text="Hello World").pack()
mkdir ~/Desktop/alfred_hw.app
cat  > ~/Desktop/alfred_hw.app/alfred_hw << .
#!/usr/bin/env pythonw /tmp/alfred_hw.py
chmod +x ~/Desktop/alfred_hw.app/alfred_hw

Thanks for the BundleAnatomy link.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20070323/bc06efc7/attachment.html 

More information about the Pythonmac-SIG mailing list