Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab can't execute python script with error: "[Errno 1] Operation not permitted"

Tags:

python

cron

I have a very simple python script that works when I execute manually. However when I set up a crontab, it finds the script but returns the error "[Errno 1] Operation not permitted".

I tried to set up a root crontab with the command

sudo crontab -e

but the same error occurs.

Here's my crontab:

* */1 * * * /usr/bin/python /absolute_path/test.py > /absolute_path/cron_log_test.log  2>&1

Edit: Everything was working great until I updated to macOS Catalina.

like image 324
user2726222 Avatar asked Oct 28 '19 15:10

user2726222


1 Answers

I was able to get my crontab (which calls python) back on track by giving /usr/sbin/cron "Full Disk Access". It's important to note that simple cron jobs were still executing, but my python based jobs were returning "Operation not permitted".

The link that andrea_grioni is on the right track, but aims at giving terminal permission to edit the crontab. This was merely a convince in my case by removing the "allow/deny" dialog. link: Here is a more appropriate link.

like image 154
Mitch Avatar answered Nov 16 '22 04:11

Mitch