3

I have been trying to get a .py file to open in the interpreter instead of in gedit and feel like i'm banging my head off a wall.

I have selected "Allow executing file as program" in Permission (it was already on to begin with). I have also ensured that "#!/usr/bin/python" is at the top of the file.

I have also chmod +x "script.py"

I am unsure what else to try, everything I have been reading has suggested this should work. But it still open's in gedit everytime the only way I can get this file to run is via terminal using either ./script.py or python script.py commands.

I am mostly a windows user and only tend to use Linux for testing purposes so please bear with me in your responses as I am not an expert on this by any means.

Thanks for any advice you can give.

Will

Will01
  • 33
  • See if this helps http://askubuntu.com/questions/377103/how-to-find-a-program-in-ubuntu/377115#377115 – Mitch Nov 16 '13 at 18:59

1 Answers1

4

Its just a setting in the file browser Nautilus. Go to Edit > Preferences > Behaviour

enter image description here

Choose Run executable... to run an application on opening. To avoid running an application unwantedly it is however better to choose Ask each time.

Takkat
  • 142,284
  • Lol, i'll be damned, that was so easy, I feel really stupid now. Thanks for your help :) – Will01 Nov 16 '13 at 19:51
  • Thanks for that, I didnt even think to look in setting before posting the thread, but nice to know all the same :) – Will01 Nov 16 '13 at 20:45