Run python script from Finder rather than edit?
- Start up Automator
- Choose application
- In the Actions bar, select Library, and search for Shell
- Drag "Run Shell Script" to the right pane.
- Change pass input to "as arguments"
Change the script to
for f in "$@" do python "$f" done
Save it (possibly in the application folder, but can be anywhere) as Python.app
Now if you want .py files to always launch with python:
- Select a .py file
- File -> Get Info
- In the Open with selection, choose Other, and select the Python.app you created.
- Click Change All
I suggest you install the latest version of Python (not the one installed on Mac OS X as of Mountain Lion). It includes PythonLauncher that does just what you want.
- Install the latest version of Python (download)
- Run "Update Shell Profile.command" (in Applications/Python 2.7) to make sure python is in your shell's PATH
- Select a .py file
- File -> Get Info
- In the Open with selection, choose Other, and select the PythonLauncher app (in Applications/Python 2.7)
- Click Change All