Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a simple python script (with GUI in wx) and I would like to run it on Ubuntu, simply by just double-click it. I tried

  1. chmod ugoa+x
  2. my script has the hash-bang line at the beginning (like #!/usr/bin/env python)

but still doesnt work, when I double-click it, it opens in python IDLE :/

share|improve this question
Do you get the desired behavior when you run it from the command line? – terdon Nov 30 '12 at 12:27
@terdon: when I run it in terminal: python it works – Brian Brown Nov 30 '12 at 12:52

I'm not 100% savy with Ubuntu, but to me it looks like you're using the associated program (through calling env).

I'd try changing the line to directly calling python:

share|improve this answer
thanks, but its even worse now: it dont want to open at all, even in pythons IDLE when I changed that line – Brian Brown Nov 30 '12 at 12:12
What command do you use if you'd like to run it from a terminal window (without IDLE)? – Mario Nov 30 '12 at 12:25
I run it like this: python and it works then – Brian Brown Nov 30 '12 at 12:53
That's crazy. The hashbang is intended to remove the need to call a program like that. It should be able to figure out for itself what kind of script it is. – Ian Atkin Nov 30 '12 at 15:31
Could you try it with a more simple script? Maybe you just screw up the working directory or something like that. You should be able to just use #!python according to your last comment. – Mario Nov 30 '12 at 15:33

I think Mario is on the right track here. Is python at /usr/bin/python? Check by running this command:

which python

Also, check if your script runs correctly without specifying python (that's what the hash-bang line is for):

Finally, make sure that the command run by the desktop shortcut (right click => properties) is one that runs correctly from the command line.


Since it seems to be a path problem, sdd the full path and command to the desktop shortcut. Right click => Properties and edit the command. If your script is in, for example, /home/brian/ use this as the command:

python /home/brian/
share|improve this answer
yes, it is, look: $ which python /usr/bin/python but it dont want to run, when I type in terminal: only ... – Brian Brown Nov 30 '12 at 13:30
Do you get an error message when running like that? And try running it with the full path: /path/to/script/ – terdon Nov 30 '12 at 14:50
It's a security measure. You can't run non-PATH stuff without adding at least a relative path. So try executing ./ rather than – Mario Nov 30 '12 at 15:23
@BrianBrown, see updated answer. – terdon Nov 30 '12 at 15:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.