0

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

  • 1
    Did you turn on the screen?? Cant help you more with "all" that information – Wonka Apr 23 '21 at 12:17
  • 1
    It's difficult to assist without a [mcve]. Does your game attempt to load external resources, e.g. images or sounds? If so, have you included the files correctly? This [answer](https://stackoverflow.com/a/41215253/2280890) provides details. – import random Apr 23 '21 at 12:39
  • @Wonka I'm new to this platform this is literally my first question, can you describe what information should I edit in? thanks – Yali Stern Apr 23 '21 at 12:56
  • https://stackoverflow.com/help/how-to-ask – Wonka Apr 23 '21 at 12:57
  • @Wonka I red it, I meant if there's any info missing in this specific question – Yali Stern Apr 23 '21 at 13:12
  • omfg it was because i used comicsans and not arial i needed to delete every function of my 900 one by one line code to get it – Yali Stern Apr 23 '21 at 14:54

0 Answers0