I am running a Django application with a few cron tasks. Whenever I run python manage.py crontab add to register the cron tasks, I get a "mail" in the Terminal showing the following traceback:
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site.py", line 609, in <module>
main()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site.py", line 592, in main
known_paths = venv(known_paths)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site.py", line 510, in venv
with open(virtual_conf, encoding='utf-8') as f:
PermissionError: [Errno 1] Operation not permitted: '/Users/<local_path>/venv/pyvenv.cfg'
I am running on macOS Catalina, python 3.7.3 in a virtual environment venv.
I have tried giving full disk permission to bash, crontab, terminal, xcode and pycharm.
I have also tried installing python versions 3.7.8 and 3.8.3
I disabled System Integrity Protection using csrutil disable in Recovery Mode and the cron ran successfully. However, I do not see it as full solution.
I dockerized the app and ran it as a docker container.
I was facing the same problem and after a few searching i found a error with cron permissions.
This is how i solved:
Go to System Preferences -> Security & Privacy - Privacy -> Full Disk Access
Click on the + icon to add an item
If the lock appears locked, click on him to unlock with your user password
Press Command + Shift + G to open a dialog
Type /usr/sbin/cron and press Enter
Search and select the cron file and click Open
Okay, now it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With