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
Partially solved
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.
Final solution
I dockerized the app and ran it as a docker container.