I used pyinstaller to bundle a program into one .exe file, which as you know makes a temporary _MEIPASS folder on execution.
The program itself has an input method for exit via sys.exit() which removes the _MEIPASS folder, but if the user closes the terminal via the window close button (X) the folder remains, and by the next execution another _MEIPASS folder will be created which will lead to a lot of MEIPASS folders after a while.
I want to know:
Is there any way to force the .exe file to create a specific folder with the same name each time it runs to avoid multiple folders?
Or just make the 'X' button to act like sys.exit() and remove the _MEIPASS folder.
My .spec file:
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='CookieVPN',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir='E:/CookieVPNtmp/',
console=True , icon='cookievpn.ico')
I also tried:
- 'E:\CookieVPNtmp\'
- 'E://CookieVPNtmp//'
- 'E:\'
- '/CookieVPNtmp' <--- This make the _MEIPASS folder in the root directory which the program was executed
--onefile
option and use the one folder option instead (I am posting this b/c I did not know about the "one folder" alternative).