I created a game in Pygame and tried to use Pyinstaller to make it an executable program but when I run it the only thing that appears is a black screen that just closes after a few seconds. I tested the game by running it on cmd (the .py file) and it works smoothly. there are some images that I load but I did put them in the same directory, I put the .exe file in the exact same spot as the .py file
There's no errors or anything, it just crashes
Here's my .spec:
block_cipher = None
a = Analysis(['main.py'],
pathex=['C:\\Users\\USER\\Desktop\\Sites\\or'],
binaries=[],
datas=[],
hiddenimports=['pygame', 'time', 'random', 'pygame.locals'],
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='main',
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,
upx_exclude=[],
name='main')
It's not about the pygame module, I created a new script creating a pygame window and tried to run it, it worked perfectly fine