View Full Version : python programs wont work without a terminal command

December 22nd, 2008, 01:27 AM
i have been trying to lern python and have recently moved to ubuntu and dont know to get it to run a python program at the dubble click and it it only a command line program (.py) that i have made
how do i get it to run straght away when i click on it

December 22nd, 2008, 03:28 AM

at the end of your python program. This will keep the program from ending until you press enter.

Now when you double-click the program in nautilus, a window should appear asking if you wish to run the program in a terminal, display, cancel or run. Select "Run in terminal".

December 22nd, 2008, 03:34 AM
And you're gonna want to put:

as your first line, if you didn't know that.
This tells the terminal what to do with the program (to run it with python).

December 22nd, 2008, 05:55 AM
Make it executable:

chmod +x spam.py

And don't forget make this the first line in your program:

#!/usr/bin/env python