But first stumbling block is an #ubuntu #annoyance. Why oh why doesn’t double-clicking a .py file do the right thing?
The right thing to me is this:
- Run “python file.py”
- Do not open a terminal window! Many Python games are based on PyGame or Pyglet, both if which open their own window
- .. unless something is caught in stdout or stderr; then I want to see what happened
(2) is even more “for sure” if the file ends with “.pyw” which under Windows means exactly “Do not open any console window”.
The thing that could go wrong with this approach, as I see it, is if the Python script, without outputting anything to the stdout/stderr, requests input from stdin first of all. Then, that “algorithm” would fail silently (nothing displayed, a “dead” python interpreter in memory). Maybe some hacker can find a solution to this.
On my Ubuntu 9.04 system, exactly *nothing* happens when I double-click a .py file. When I right-click and choose custom command, and type “python” there, a terminal window flashes by, then closes in a blink, throwing away any error message for me to see (wild guess: wrong working directory?).
/rant from an otherwise positive Ubuntu user/programmer
PS. I really hope 10.04 has fixed this; the way I see it Python is one of the most promising creative multimedia languages for Ubuntu. DS