Mac app bounces in system dock, closes, and then re-opens

42 views
Skip to first unread message

Paul Fishback

unread,
May 8, 2023, 1:39:13 PM5/8/23
to PyInstaller
I have a simple app built from a python script, heatplotter.py, which utilizes
PyQt and pyqtgraph. 

I'm able to run pyinstaller on my .spec file and create a functioning app. It runs fine from the terminal.

However, when I click on the .app icon, the icon bounces in the system tray, then closes, and, after about 15 seconds, re-opens. I've never had this happen before. Of course, this annoying, and I'd like to prevent it from happening. 

Any guesses as to the reason? Here's my .spec file:

# -*- mode: python ; coding: utf-8 -*-

import os.path
block_cipher = None

data=collect_data_files('PyQt5')

a = Analysis(
    ['heatplotter.py'],
    pathex=[],
    binaries=[],
    datas=data,
    hiddenimports=['pyqtgraph'],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=['PySide6'],
    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,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='MyApplication',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
app = BUNDLE(
    exe,
    name='MyApplication.app',
    icon=None,
    bundle_identifier=None,
)

Chris Barker

unread,
May 9, 2023, 3:22:52 AM5/9/23
to pyins...@googlegroups.com
I have no idea, but some debugging hints:

1) how are you running it from the terminal? If you aren't alreadyk, try:

open TheApp.app

Then you *may* get the failure, and if so, hopefully some output on the console.

2) Open the Console App:

/System/Applications/Utilities/Console.app

Then try to start your app -- hopefully you'll see some eros reported that might give you a hint.

Good Luck -- got to love how Apple hides stuff from the user :-(

-CHB




--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/68616ce5-30c3-47fb-a4b1-76675d3374ffn%40googlegroups.com.


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov

bwoodsend

unread,
May 10, 2023, 2:48:49 AM5/10/23
to PyInstaller

However, when I click on the .app icon, the icon bounces in the system tray, then closes, and, after about 15 seconds, re-opens.

It’s a side effect of --onefile mode combined with --windowed mode (or the .spec file equivalents). Because a onefile executable is an executable within an executable you get a bouncing icon for the outer executable which disappears when macOS realizes that it’s not really a GUI then the inner executable launches which creates a new bouncy icon. The fix is just not to use onefile mode which is fairly useless combined with windowed. It should boost your startup time too.

Reply all
Reply to author
Forward
0 new messages