How to run Python script with one icon click?

A. K. Tolentino picture A. K. Tolentino · Aug 7, 2012 · Viewed 15.6k times · Source

Sorry, for the vague question, don't know actually how to ask this nor the rightful terminologies for it.

How to run a python script/bytecode/.pyc (any compiled python code) without going through the terminal. Basically on Nautilus: "on double click of the python script, it'll run" or "on select then [Enter], it'll run!". That's my goal at least.

When i check the "Allow executing of file as a program" then press [enter] on the file. It gives me this message:

Could not display "/home/ghelo/Music/arrange.pyc". There is no application installed for Python bytecode files. Do you want to search for an application to open this file?

Using Ubuntu 12.04, by the way and has to be python 2, one of the packages doesn't work on python 3. If there's a difference between how to do it on the two version, include it, if it's not to much t ask, thank you.

I know it doesn't matter, but it's a script auto renaming & arranging my music files. Guide me accordingly, stupid idiot here. :)

Answer

Noufal Ibrahim picture Noufal Ibrahim · Aug 7, 2012

You should make the .py files executable and click on them. The .pyc files cannot be run directly.