--Environment --Windows10 Pro version 1909 - Python 3.8.5 - Pandas 1.0.5
I made a code to read an Excel file with Python, made it an exe file with PyInstaller, changed the directory and executed it at the command prompt, and I got angry.
> my-code.exe
The check process has started. Do not close the screen.
Traceback (most recent call last):
File "my-code.py", line 256, in <module>
File "my-code.py", line 218, in check_files
File "pandas\io\excel\_base.py", line 304, in read_excel
File "pandas\io\excel\_base.py", line 824, in __init__
File "pandas\io\excel\_xlrd.py", line 21, in __init__
File "pandas\io\excel\_base.py", line 353, in __init__
File "pandas\io\excel\_xlrd.py", line 36, in load_workbook
File "xlrd\__init__.py", line 148, in open_workbook
File "xlrd\book.py", line 92, in open_workbook_xls
File "xlrd\book.py", line 1278, in getbof
File "xlrd\book.py", line 1272, in bof_error
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'\t\x92\x86\x88\xe4 \x90^'
[12704] Failed to execute script my-code
my-code.py
import pandas as pd
def check_files():
#Read an Excel file
book = pd.read_excel(excel_file, sheet_name=None, header=None)
There was a file that started with ~ $
that was created when I opened the Excel file ...
Sometimes it remains even after closing the Excel file ... I couldn't see it in Explorer, but I could see it with the dir
command ...
> dir data\
# ...abridgement...
2020/10/07 10:30 165 ~$Excel to be processed.xlsm
#Delete garbage files
> cd data\
> del "~$Excel to be processed.xlsm"
#It worked when there was no garbage
> cd ../
> my-code.exe
The check process has started. Do not close the screen.
The processing of the tool is finished.
Recommended Posts