Automator: `command not found` (Python script for command line) I am trying to create an Automator application, which allows me to convert Python script files .py files to Jupyter Notebook files .ipynb using Python script for command line jupytext. However, the following in the textbox of Run Shell Scrip of Automator generates an error command not found.

for f in "$@"
do
 jupytext --to notebook "$f"
done 


This is despite the fact that no such error occurs if I run the following in Terminal on Mac.

jupytext --to notebook &lt;filename&gt;.py


Does anyone has any ideas about what is/are missing?
Most likely, you need to tell Automator's shell instance where to locate the program jupytext.  Unless you saved jupytext somewhere specific on your hard drive, my guess is that the full path to jupytext is going to be /usr/local/bin/jupytext.  However, you can retrieve its location by opening up Terminal and using the command:

which jupytext


which will return the file path to the program.

Then, in your Automator action, replace jupytext with its full path, e.g.:

for f in "$@"; do
    /usr/local/bin/jupytext --to notebook "$f"
done