I am making a game in pygame and my friend came across following issue when trying to run the following code.
import pygame
pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('winter gam')
pygame.display.update()
running = True
clock = pygame.time.Clock()
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
running = False
clock.tick(60)
screen.fill((0, 0, 0))
pygame.draw.rect(screen, (255, 0, 0), [10, 10, 100, 100])
pygame.display.update()
pygame.quit()
I ran this code fine on my linux distro, but my friend, who's running OSX 10.13.6, came across an error when he tried to run it saying "Illegal instruction: 4".
The only thread that provided any solution was this one: Illegal instruction: 4 on MacOS High Sierra
When we changed the line "pygame.init()" to "pygame.font.init()" the code worked fine on his machine as well as on mine, which is strange because pygame.font.init() should only initialize pygame.font?
Does anybody know why this works and/or have a better solution to this problem?
Python version is 3.6, pygame version is 1.9.4.