Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 10.15.6 Failed to import the site module #116

Open
iHTCboy opened this issue Sep 9, 2020 · 3 comments
Open

macOS 10.15.6 Failed to import the site module #116

iHTCboy opened this issue Sep 9, 2020 · 3 comments

Comments

@iHTCboy
Copy link

iHTCboy commented Sep 9, 2020

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
Copy link
Author

iHTCboy commented Sep 10, 2020

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 iHTCboy changed the title macOS 10.15.6 error macOS 10.15.6 Failed to import the site module Sep 10, 2020
@HumanRupert
Copy link

+1

@bytebound
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants