I am trying to use Automator on macOS 10.12 to launch a Python 3 script. The script works just fine when I run it from the terminal with the command: python3 my_script.py.
Automator has a "Run Shell Script" function that uses the /bin/bash shell. The shell will run scripts with the command: python my_script.py, but this only seems to work for scripts written in Python 2.7.
My script starts with #!/usr/bin/env python3, which I thought would direct the shell to the correct python interpreter, but that doesn't seem to be the case.
As a workaround, I can get the script to run if I insert the full path to the python interpreter: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3, but I see this as suboptimal because the commands might not work if/when I update to Python 3.6.
Is there a better way to direct the /bin/bash shell to run Python3 scripts?
chmod +x my_script.pyyour script will be executable, then you can just run./my_script.pywithout needingpython3 my_script.py- Mark Setchellchmod +x, but it didn't help. The permissions are:-rwxr-xr-x. - Slipupwhich python3it should tell you the correct path for your shebang. - Mark Setchell