2

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 <filename>.py

Does anyone has any ideas about what is/are missing?

marked as duplicate by nohillside terminal Dec 22 '18 at 9:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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

Not the answer you're looking for? Browse other questions tagged .