Hello! I am running into a very peculiar situation with python (3.8.8)… I have been using python for 3 years now and was working on some very basic code last night that involved reading excel files using pandas (1.2.4) - everything worked great. However, this morning, I woke up and ran the exact same code and I received an error from pandas suggesting that there was no such file or directory. I had not changed the file path since the night before and I am using the full file path in my code. I can even copy and paste this file path into my file explorer and the excel file will open up.
I tried debugging within pandas with no luck. I then decided to uninstall and reinstall Anaconda with no luck. I then upgraded versions of pandas to 1.3.0 with no luck. Then I tried downgrading to 1.2.3 with no luck. Then I uninstalled and reinstalled Anaconda just for fun with no luck.
Eventually I decided to see if python’s os library was able to recognize excel files that pandas wasn’t able to read in. Interestingly, whenever I used os.listdir(), every file in the folder showed up EXCEPT for the .xlsx files. I tried this with multiple directories and the result was consistent. Python does not seem to be recognizing my .xlsx files. So I decided to uninstall Anaconda and install a fresh version of python (3.9.6). I used the same os.listdir() code and got the same result - .xlsx files were nowhere to be found in the output.
I am so confused!! I have spent hours trying to debug this and I have not had any luck whatsoever. Does anybody happen to know why this could be happening? Any suggestions? Thank you all so much in advance!!
EDIT: After further debugging, I decided to try placing an excel file directly in my C:/ drive and python was able to recognize and read this file in. I then created a folder in this location, put the file in the folder, and I am still able to access the file. However, I am still unable to even recognize the file if it is in my user folder, where I have been accessing files without a problem up until this morning. This is a very inconvenient workaround, so if anybody has any input, I would still very much appreciate it.