django-crontab
django-crontab copied to clipboard
macOS 10.15.6 Failed to import the site module
Environment & Versions
- Operating system: macOS 10.15.6
- Python: 3.8.5
- Django: 3.1
- django-crontab: 0.7
Settings
- My
django-crontab
settings:
CRONJOBS = [
...
]
Details
- Output of
crontab -l
after runningpython manage.py crontab add
.
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/Users/HTC/Downloads/Python/venv/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/Users/HTC/Downloads/Python/venv/bin/python'
sys.base_prefix = '/Users/HTC/Downloads/Python/venv/bin/..'
sys.base_exec_prefix = '/Users/HTC/Downloads/Python/venv/bin/..'
sys.executable = '/Users/HTC/Downloads/Python/venv/bin/python'
sys.prefix = '/Users/HTC/Downloads/Python/venv/bin/..'
sys.exec_prefix = '/Users/HTC/Downloads/Python/venv/bin/..'
sys.path = [
'/Users/HTC/Downloads/Python/venv/bin/../lib/python38.zip',
'/Users/HTC/Downloads/Python/venv/bin/../lib/python3.8',
'/Users/HTC/Downloads/Python/venv/bin/../lib/python3.8/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000000010cadcdc0 (most recent call first):
<no Python frame>
new issues:
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 579, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 562, in main
known_paths = venv(known_paths)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py", line 480, in venv
with open(virtual_conf, encoding='utf-8') as f:
PermissionError: [Errno 1] Operation not permitted: '/Users/htc/Downloads/project-py/venv/pyvenv.cfg'
+1
Had the same issue. This solution by Patrick Freitas worked for me:
- 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 it 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
Original post: https://stackoverflow.com/questions/62876343/permissionerror-errno-1-operation-not-permitted-users-local-path-venv-py