This is what I have working for me (edit: I got this information from
http://standards.freedesktop.org/deskto ... index.html). Open your file manager, press Ctrl+H to show hidden files and folders, and go to .local/share/applications in your home folder. Create a new text file, call it "python.desktop". Edit the python.desktop file and put the following in it:
- Code: Select all
[Desktop Entry]
Type=Application
Name=Python
Exec=python %U
Terminal=true
MimeType=text/x-python;
Categories=Development;
Save and close the file, and in the Programming section of your menu you should now have an entry called Python. If you click that, a terminal will open and you will start an interactive Python session.
Now, in your file manager right-click a Python script of yours and from the context menu select Properties (this may only work on Cinnamon 1.6.7 with Nemo as your file manager). Then go to the "Open With" tab, and click on "Show other applications". In the list you will now find Python, so Add it and if you want "Set as default". If you now double-click a Python script of yours, it will be run on a terminal with the Python interpreter.
If you don't want your scripts to run in a terminal by default, replace "Terminal=true" with "Terminal=false".
The terminal will close as the application finishes. So if you want the terminal to stay open, edit your script to wait for user input at the end. For Python 2.7:
- Code: Select all
raw_input("<Press ENTER to close>")
For Python 3:
- Code: Select all
input("<Press ENTER to close>")
Edit 2: of course, if you make a Python script file executable and then double-click it--the file manager will ask you if you want to edit or execute it, without the need for any of the above...