Try to open file that exists with visual Studio Code 1.43.2
This is the py file:
with open('pi_digits.txt') as file_object:
contents = file_object.read()
print(contents)
This is the result:
PS C:\Users\Osori> & C:/Python/Python38-32/python.exe "c:/Users/Osori/Desktop/python_work/9_files and exceptions/file_reader.py"
Traceback (most recent call last):
File "c:/Users/Osori/Desktop/python_work/9_files and exceptions/file_reader.py", line 1, in <module>
with open('pi_digits.txt') as file_object:
FileNotFoundError: [Errno 2] No such file or directory: 'pi_digits.txt'
The files exists and the spelling is correct. if the file_reader.py is run with IDLE runs just fine.