简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM