PyInstaller bundle creates two windows?!

493 views
Skip to first unread message

Zachary Spector

unread,
May 2, 2017, 7:34:34 PM5/2/17
to Kivy users support
have my app working fine in Windows, using Python 3.5 and the latest nightly wheels. I've got it packaging in PyInstaller, too, and the bundled executable runs fine...except that it opens two windows, the frontmost of which is completely useless, showing only blank white. It won't close cleanly, either. I have to force quit.

I don't feel good distributing my app in such a state. How do I make that front window go away?

ZenCODE

unread,
May 2, 2017, 9:44:25 PM5/2/17
to Kivy users support
It could be the 'console' setting in your pyinstaller spec file? Please post that, and perhaps a minimal example that can verify the problem. There should be now other window if that is set to False.

Zachary Spector

unread,
May 3, 2017, 9:19:38 PM5/3/17
to Kivy users support
I'd love to make a minimal example, but I haven't succeeded in demonstrating the behavior that way. I thought it might be to do with the subprocess I was running, but launching one in touchtracer's build method didn't do anything; I thought my overloaded ScreenManager might be to blame, but making one with a bunch of useless extra screens didn't even slow things down.

It's definitely not the console setting, though. The window I'm referring to looks nothing like a console window.

Here's my .spec...

# -*- mode: python -*-
from kivy.tools.packaging.pyinstaller_hooks import hookspath, runtime_hooks, get_deps_minimal
block_cipher = None

mindeps = get_deps_minimal(audio=None, video=None)
mindeps['hiddenimports'].extend([
'ELiDE.kivygarden.collider',
'ELiDE.kivygarden.stiffscroll',
'ELiDE.kivygarden.texturestack',
'kivy.weakmethod'
])

a = Analysis(['src/main.py'],
             pathex=['src'],
             binaries=[('src/ELiDE/kivygarden/collider/build/lib.win32-3.5/collider.cp35-win32.pyd', '.')],
             datas=[
                 ('src/ELiDE/assets', 'ELiDE/assets'),
                 ('src/LiSE/sqlite.json', 'LiSE')
             ],
             hookspath=hookspath(),
             runtime_hooks=runtime_hooks(),
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
**mindeps
)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='RunThis',
          debug=False,
          strip=False,
          upx=True,
          console=False )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
  Tree('C:/ELiDEa7/kivyenv/share/sdl2/bin'),
               strip=False,
               upx=True,
               name='ELiDEa7')


I dunno if you'd want to take the time, but here's a bundle of the whole source of the app, should you want to take a stab at debugging it. License is GPL3, except for the allegedb directory, which is BSD.

Zachary Spector

unread,
Jun 4, 2017, 12:32:04 PM6/4/17
to Kivy users support
What eventually worked was to move a particular import into the ``__main__`` block of my main.py. The module in question imported stuff from the ``kivy.window`` module, which creates a window on import; and Windows has to launch processes with the ``spawn`` method, which may result in main.py getting imported twice.
Reply all
Reply to author
Forward
0 new messages