问题
I'm writing a simple game with python, pygame and py2app. (I use python 2.6) When I build my game in alias mode, it works fine, but when I build for deployment, the app I get crashes immediately after lunching. Anyone know what's going on?
回答1:
To provide a more thorough answer to this whole issue, I'm going to use the aliens.py example. When built in OS X, you will see quick flash as the game quickly initializes and quits. Opening console reveals an error message similar to
Fatal Python error: (pygame parachute) Segmentation Fault
Job appears to have crashed: Abort trap
I believe the issue is that the default font is not being included during the packaging process.
In the aliens.py sample for instance, throw a supported font into your data folder and change
self.font = pygame.font.Font( None ), 20)
to
self.font = pygame.font.Font( os.path.join('data', 'Copperplate.ttc'), 20)
This should allow the app to complie and play without issue.
来源:https://stackoverflow.com/questions/3470377/my-py2app-app-will-not-open-whats-the-problem