I am trying to package my tkinter application into a single file executable. Whenever I set the console option to False
, I run into a message box that states that reads "Failed to execute script xxx". However, if I enable the console window in my .spec
, I can run my program just fine.
I have included my spec
file below. I execute the file with:
pyinstaller --onefile -w build.spec
spec
file code:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['MainPage.py'],
pathex=['C:\\path-to\\prog'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
a.datas += [('icon.ico','C:\\path-to\\icon.ico','DATA')]
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='prog.exe',
debug=False,
strip=False,
upx=False,
console=False , icon='icon.ico')
Why is my application failing to execute when I change the console option?
I ran into similar issue while using a module that was logging some information in console (progress bar). Once I disabled all information output to console, it was running fine.
You might want to check what actually happens in console when you use your app and disable/remove console interaction if you intend to run without it.
p.s. And next time I should check the post date first =P
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With