Pyinstaller executable not running returning this error in command prompt
C:\Users\user>C:\Users\user\test\dist\main\main.exe
Traceback (most recent call last):
File "main.py", line 13, in <module>
File "pandas\io\excel\_base.py", line 504, in read_excel
File "pandas\io\excel\_base.py", line 1563, in __init__
File "pandas\io\excel\_base.py", line 1419, in inspect_excel_format
File "pandas\io\common.py", line 872, in get_handle
FileNotFoundError: [Errno 2] No such file or directory: 'test_1.xlsx'
[33428] Failed to execute script 'main' due to unhandled exception!
It can't find the xlsx file although it is in the same directory as the exe.
The code itself
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
`# In[2]:
df = pd.read_excel('test_1.xlsx')
# In[3]:
df.dropna(inplace=True)
# In[4]:
df.rename(columns={'Spot start time':'Start time','Spot position':'No','Spots count':'To','Spot Name':'Description','Spot duration':'Real Length','Spot ID':'Audio Desc','Spot TVCompany':'TVCompany'}, inplace=True)`
I tried both --onefile and --onedir option, same results