I have again problems with that famous Exception. The problem is the following: I have wanted to write a simple code for an easy exercise about files and excel libraries (openpyxl) that I have to be make for my python programming course. At first, I have to say that I usually make all my codes in iOS. For this time, I have wanted to do this exercise in my old PC whose O.S. is Windows, so I have exported the file where I work in iOS in a pen drive and next, export that file in my Windows desktop. I opened VSC and the first code's line is the problem because I try to load the excel file but the exception FileNotFoundError appears.
As simple as write:
import openpyxl
fw = openpyxl.load_workbook("Data_File_2.xlsx")
The file when I'm writing the code is in the follow route: C:\Users\xxxx\Desktop\pyWork which is the same route where the file "Data_File_2" is in it. Well, the problem continues because every time I want to write a new code for working with extern files, this Exception appears again, even with other 'py' files that I made where I worked with extern files and now I can't run because this Exception appears again and block the program. (I'm talking about old files made in previously days or weeks which works correctly with external files) For example, now I'm trying to open a try file .txt from a new py.file, both of them located in the same directory:
with open("try_to_open.txt","r") as op_file:
rfile = op_file.read()
print(rfile)
#The exception FileNotFoundError appears again in the first line.
I know that I can use try/else blocks but I want to know why this Exception appears, what is the Error in this case and why it appears every time I want to work with external file one time that the Exception appears at first.