Reputation: 442
I've got a basic Tkinter window (Just a title and logo), and wanted to try out/practice PyInstaller. However when I use try to open the .exe file nothing happens. I used the command: pyinstaller test_script.py (test_script is just the name of my file. I did this in the directory where the file is located)
I'm using windows 10 and python 3.7.3. I'll put my Tkinter code below, if it's any help, and also my spec file (I'm not sure if it'll be formatted correctly, I'm new to this site):
from tkinter import *
root = Tk()
root.title("Test Application 1")
root.iconbitmap("favicon.ico")
root.geometry("700x500")
root.mainloop()
### --- Spec file --- ##
# -*- mode: python -*-
block_cipher = None
a = Analysis(['test_script.py'],
pathex=['C:\\Users\\User\\Documents\\Python stuff\\Other
apps\\Misc\\TestApplicationOne'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='test_script',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='test_script')
I get no errors or anything, the application just doesn't open. I've tried opening the .exe in both the dist and build folders. I've also deleted everything and started again, and still no luck. The application seems to open for a split second and then instantly close.
Upvotes: 1
Views: 1915
Reputation: 1
For me, the problem was the icon. Removing the root.iconbitmap()
line helped.
Upvotes: 0
Reputation: 21
try to use the following code pyinstaller -F -w --icon=favicon.ico test_script.py , you might also use the debug option to get a verbose output of what is happening and where the error is
Upvotes: 1