Problem
I'm using PyInstaller on Windows to make an .exe file of my project, basically my projects generates a csv file as output and the name of the csv file is dependent on the current time so the program generates unique file each time it is ran
I couldn't find any resource online that could help me with this problem
PyInstaller Command that I used: (data.csv file added is supposed to be bundled with exe so no issue there)
pyinstaller src\main.py -F --name "Attendance_System" --add-data "src\data.csv;data" --add-data "C:\Users\Darshit Shah\OneDrive\Desktop\TCET\Att_Sys\att_sys\Lib\site-packages\customtkinter;customtkinter" --clean
code block where the file is generated:
except KeyboardInterrupt:
timer.cancel()
endTime = str(dt.datetime.now().time())
op_file = f"{app.currdate}_{app.startTime[0:-7]}_{endTime[0:-7]}.csv".replace(":","-")
app.getList().to_csv(f"{op_file}")
print("O/P File generated")
sys.exit()
Basically the code generates the file in the folder where my main.py is located but after bundling it with PyInstaller i cant seem to achieve that
Project Structure
my_proj
|
|--build
|
|--dist <--- "This is Where i want my output file to generate"
| `--my_proj.exe
|
|--proj_venv
| |--Include
| |--Lib
| |--Scripts
| `--pyvenv.cfg
|
`--src <--- "Folder where my output file would normally generate without .exe"
|--classes.py
|--interface.py
|--main.py
`--data.csv