Python Forum

Full Version: EOF while scanning triple-quoted string literal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
file_name = (r'C:\Users\user\Desktop\ehmatthes-pcc_2e-9e7977b\chapter_10\alice.txt')

with open(file_name) as f_obj:
contents = f_obj.read()


Output: Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 579, in <module>
main()
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 562, in main
known_paths = venv(known_paths)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 494, in venv
addsitepackages(known_paths, [sys.prefix])
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 349, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site.py", line 159, in addpackage
f = open(fullname, "r")
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\encodings\__init__.py", line 100, in search_function
level=0)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 308

^
SyntaxError: EOF while scanning triple-quoted string literal




Question: pls help, have anyone know what the issues?
Somewhere you have started a triple-quoted comment and not completed it.

print("start")
"""This is a triple-quoted comment
   oops, I didn't close in properly""
print("end")
Output:
$ python3 quoteit.py File "quoteit.py", line 6 ^ SyntaxError: EOF while scanning triple-quoted string literal