Major edit
I've just discovered that the Automator workflow I'm having problems with works perfectly if I run it by pressing 'play' in the Automator window, and it seemingly only fails when I save it as a Quick Action and try and run it by clicking the button in the Preview pane.
Original post
I have an Automator action that iterates through a list of files selected in the Finder, running a python script on each of them in turn. The workflow receives a list of files or folders in the Finder, and then consists of a single 'Run Shell Script' block with 'Pass input: as arguments'.
for f in "$@"
do
/path/to/python_distro /path/to/script.py "$f"
done
In Catalina, this fails with an error:
The action “Run Shell Script” encountered an error: “path/to/python_distro: can't open file '/path/to/script.py': [Errno 1] Operation not permitted
How can I get Catalina to permit this? I've already tried adding Automator to the list of apps that are allowed Full Disk Access, and restarted Automator and killall Finder
'd, but that did not fix my problem.
print("Hello World")
script from automator?print()
statements setting the shell to Python works, but havingscript.py
above simply be a single print statement does not.print()
statement works okay is due to the edit above. Although if you find out how to change the PATH in automator so that you can import third-party packages, I suspect that would also solve the issue I'm having here, so please post it as an answer!