Python, Linux, Desktop Environment

Lee Harr lee at example.com
Wed Nov 16 18:07:08 EST 2005


On 2005-11-16, jeremyvoros at gmail.com <jeremyvoros at gmail.com> wrote:
> So, I've written my first GUI app in python.  I've turned it into a
> binary .exe and .app that runs on Windows and Mac respectively, but on
> my Linux box, where I wrote the thing, I still have to drop to the
> command line and ./myscript.py.  What can I do to make it a "click and
> run" sort of application in KDE or Gnome on Linux?
>


Have you heard of a "shebang line"?

That is when the first line of a file starts with #!

You probably want ...

#!/usr/bin/env python


That will run the commandline from that first line.
Remember, it must be the very first thing (no spaces).


You may also need to be in a particular directory in
order to access program resources. I usually end up
making a little .sh script like ...

#!/bin/sh

cd /my/python/prog/dir && python myprog.py



Most of the recent window managers are using the
so called .desktop files. You could copy one of
those from another program (try creating a "link
to application" or an "application launcher" on
your desktop).

I think most wms will also just run your shell
script if the permissions are set correctly.




More information about the Python-list mailing list