4

I have a python script that I can run in the usual way using Terminal. For example, launch Terminal, cd to the directory, then type ./xxx.py where xxx.py is the name of the file that contains the script.

Now I want to make an icon on the desktop that launches Terminal and runs the python file when I double click it. How do I do that? I thought I could make a shell file with the cd and the launch command and then associate that shell file with Terminal. But I can't seem to associate it with Terminal.

Somebody said to name the shell file with the suffix '.command' but that causes it to launch Flash Builder. I don't know where that associate is set. I can't manually associate Terminal because I can't find it. It isn't in /Applications.

1

1 Answer 1

1

On your Desktop you coul create a file with the following content

#!/bin/bash python PATH_TO_YOUR_PYTHON_FILE 

Then you must make it executable via

chmod u+x FILE_ON_DESKTOP 

Alternatively you can create a symbolic link to your python file and make it executable.

You can find Terminal in /Applications/Utilities

Sign up to request clarification or add additional context in comments.

1 Comment

To find Applications and files use Spotlight.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.