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

Issue #206 new
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.


Comments (3)

  1. Log in to comment