1

I am trying to automatically run a python script using automator. This script python3 ~/Desktop/python/gmaps.py works fine in terminal but not when I try to run it through Automator , I get a "module pyperclip cannot be found", even though it is found fine when running from terminal.

I can not figure out what would cause the path to be different. Is there a guide to command line plus Automator ?

  • 1
    Assuming Catalina as OS and anaconda and brew (+python3) installed you might have three different python3 execs. – klanomath Jan 21 at 2:01
  • It’s probably not as simple as a path error. Are you running bash python in the script? Seeing a bit more of how exactly you’re calling things with an edit to the post would be ideal. – bmike Jan 21 at 2:03
  • 1
    The PATH passed to a Run Shell Script action in Automator is: /usr/bin:/bin:/usr/sbin:/sbin So you need to add the appropriate environment variables. Using fully qualified pathnames of the executable is also an option, however you may need to add python specific environment variables as well as a PATH statement. – user3439894 Jan 21 at 3:20
1

Solved: I'm not sure why it worked, but running pip3 install pyperclip in the automator window installed it in the correct location for it to be used.

| improve this answer | |

You must log in to answer this question.

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