Fatal Python error: initsite: Failed to import site module

Viewed 2874

Here is the error i recieve randomly when my code runs:

Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.7/site.py", line 603, in <module>
    main()
  File "/usr/lib/python3.7/site.py", line 590, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/lib/python3.7/site.py", line 365, in addsitepackages
    if os.path.isdir(sitedir):
  File "/usr/lib/python3.7/genericpath.py", line 42, in isdir
    st = os.stat(s)
KeyboardInterrupt

I have looked and the site.py file does exist in the python3.7 directory. would upgrading to python3.9 fix this issue?

EDIT: There is no keyboard or mouse plugged into the raspberry pi. I don't know how its keyboardInterrupting.

0 Answers
Related