Hi there,
First time poster, I hope I’m doing it right.
I’m encountering a very strange issue - I’m using pandas in vscode via a docker to read a CSV file from a network folder, and it’s working fine the first time, but the second time I try it it fails with a “‘utf-8’ codec can’t decode byte <> in position <>: invalid start byte” error. Once that happens, I can’t open the file in any way using python - not with pandas, not with other python tools (such as chardet), not outside of vscode (running python directly from the docker)… However, the location of the error changes between applications (so pandas and chardet show different positions in the error), and when I open the file manually with a text editor, those positions seem fine. What’s even strange is that other users on the network can open the file without issue more than once.
This isn’t limited to a single file, but has started cropping up in different files. This is of course preventing me from working (and is also driving me insane). I hope this is something that the good folks on this forum may be able to help with…
Thanks.
*** Update ***
Turns out that if I read the file with encoding=‘cp1252’, it reads fine. However, I still don’t understand why I would be able to read the file once without it, or why others can read it without it.