Cannot create Mac app with latest pygame and latest PyInstaller

27 views
Skip to first unread message

Irv Kalb

unread,
Mar 24, 2023, 3:20:04 AM3/24/23
to PyInstaller
I'm trying to build a larger application on my Mac and getting errors.  So, I tried using a minimal test program and I'm still getting the same errors:

Mac Ventura 13.0.1
Python 3.11.1
pygame-ce 2.1.4
PyInstaller 5.9.0

Here is my test program which runs file (using PyCharm or IDLE):

import pygame
from pygame.locals import *
import sys

BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
WINDOW_WIDTH = 640
WINDOW_HEIGHT = 480
FRAMES_PER_SECOND = 30

pygame.init()
window = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
clock = pygame.time.Clock()
 
while True:
    for event in pygame.event.get():
 
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
   
    window.fill(BLACK)    
    pygame.draw.circle(window, WHITE, (WINDOW_WIDTH // 2, WINDOW_HEIGHT // 2), 60, 0)
    pygame.display.update()
    clock.tick(FRAMES_PER_SECOND)

I'm using the following spec file (because that's how I'm building my larger app):

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


block_cipher = None

a = Analysis(
    ['Main_Test.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    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,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='Main_Test',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

And this is what I see when I try to run the resulting file in dist folder:

[5196] Error loading Python lib '/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python': dlopen: dlopen(/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python, 0x000A): tried: '/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (code signature invalid in <41AEFAB3-E30A-3AED-806A-AC88734A771B> '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BBFC0, codeBlobSize=0x0001A950), '/System/Volumes/Preboot/Cryptexes/OS/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (no such file), '/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (code signature invalid in <41AEFAB3-E30A-3AED-806A-AC88734A771B> '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BBFC0, codeBlobSize=0x0001A950), '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (code signature invalid in <41AEFAB3-E30A-3AED-806A-AC88734A771B> '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BBFC0, codeBlobSize=0x0001A950), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (no such file), '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (code signature invalid in <41AEFAB3-E30A-3AED-806A-AC88734A771B> '/private/var/folders/x3/tfnjhmt16n9dcyz2r3b5g8780000gn/T/_MEIJnOC6Y/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BBFC0, codeBlobSize=0x0001A950)

logout


Saving session...

...copying shared history...

...saving history...truncating history files...

...completed.


I have no idea what any of the above means or what to do to try to fix it.

FYI:  The exact same files build just fine on Windows.

Any help would be greatly appreciated.

Irv
Reply all
Reply to author
Forward
0 new messages