Home > Blockchain >  MacOS crontab runtime stderr: /usr/local/bin/python3: can't open file 'myscript.py':
MacOS crontab runtime stderr: /usr/local/bin/python3: can't open file 'myscript.py':

Time:08-07

When trying to run a python script via a crontab schedule:

* * * * * /Users/myUser/Documents/Code/Tools/appName/myScript.py >>/tmp/crontab.log 2>/tmp/crontab.err

Even tried a few different permutations of cd in crontab and os.chdir() in my script:

* * * * * cd Documents/Code/Tools/app-use_tracker/ && /usr/local/bin/python3 app-use_tracker.py >>/tmp/crontab.log 2>/tmp/crontab.err

I kept getting the error below on stderr:

/usr/local/bin/python3: can't open file 'app-use_tracker.py': [Errno 1] Operation not permitted

I came across this solution on SO: https://stackoverflow.com/a/59574552/10761353 but giving Python3 Full disk access doesn't sound like a great(secure) idea.

I even tried 777 permissions on the python3 script, but no change in behaviour

  • Related