Here is my test code, that gives my error:
import pandas
file = 'KBART EDINA.xlsx'
data = list()
with open(file, 'r') as xl_file:
df = pandas.read_excel(xl_file)
When I run it, I get the following error:
❯ python hack.py
Traceback (most recent call last):
File "hack.py", line 11, in <module>
df = pandas.read_excel(xl_file)
File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/util/_decorators.py", line 299, in wrapper
return func(*args, **kwargs)
File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 336, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 1072, in __init__
content=path_or_buffer, storage_options=storage_options
File "/CWD/deliberately/obscured/.direnv/python-3.7.6/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 954, in inspect_excel_format
buf = stream.read(PEEK_SIZE)
File "/another/obscured/path/miniconda3/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 16: invalid start byte
I've tried with 6 different xls, xlsx, and ods files..... and they all return the same error
I have the following (relevant) libraries installed:
openpyxl 3.0.7
pandas 1.2.4
xlrd 2.0.1
I know the file(s) are readable (I had a if not os.path.isfile(file): print("####")
clause to prove that)
.... what am I missing?