django-crontab icon indicating copy to clipboard operation
django-crontab copied to clipboard

macOS 10.15.6 Failed to import the site module

Open iHTCboy opened this issue 4 years ago • 3 comments

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 running python 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>

iHTCboy avatar Sep 09 '20 08:09 iHTCboy

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'

iHTCboy avatar Sep 10 '20 12:09 iHTCboy

+1

HumanRupert avatar Jul 23 '21 14:07 HumanRupert

Had the same issue. This solution by Patrick Freitas worked for me:

  1. Go to System Preferences -> Security & Privacy - Privacy -> Full Disk Access
  2. Click on the + icon to add an item (If the lock appears locked, click on him to unlock it with your user password)
  3. Press Command + Shift + G to open a dialog
  4. Type /usr/sbin/cron and press Enter
  5. 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

bytebound avatar Nov 30 '21 11:11 bytebound