My py2app app will not open. What's the problem?

吃可爱长大的小学妹 提交于 2021-01-31 05:46:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!