1. pygame
  2. pygame
  3. pygame
  4. Issues


Issue #206 new

pygame.font.SysFont(None, 20) crashes pyinstaller generated .exe

Ben Schroeder
created an issue

Creating a font object with name = None causes pyinstaller generated .exes to crash with no traceback for explanation instead reporting that "xxxxx.exe has stopped working".

import pygame
import sys

windowSurface = pygame.display.set_mode( (450, 25), 0, 32 )
pygame.display.set_caption('Breaking pygame')

x = None  # broken_pygame.exe
#x = 'Sans'  # non-broken_pygame.exe

print "This is the line that breaks the .exe's"
basicFont = pygame.font.SysFont(x, 20)
print 'See, I never make it here when that is None'

text = basicFont.render("I can crash pyinstaller .exe's that use pygame!" , True, (255, 0, 0))
textRect = text.get_rect()
windowSurface.blit (text, textRect)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:

Using a valid name (ie. 'Sans') does not crash pyinstaller generated .exe files.

see: http://www.pyinstaller.org/export/develop/project/doc/Manual.html#adapting-to-being-frozen

Comments (3)

  1. Log in to comment