Parachute Segmentation Fault Error - pygame to py2exe

核能气质少年 提交于 2019-12-02 09:57:05

Had similar problems and that one too. Found a way to solve them:

After few weeks (had this problem even before) I'm happy to say that I solved this problem! :)

1st part of my problem (http://i.stack.imgur.com/WpkjR.png): I solved it by editing setup.py script with adding "excludes" part in it. That resulted in successful making of executable file!

Modified setup.py script:

from distutils.core import setup
import py2exe
setup(windows=['source_static.py'], options={
          "py2exe": {
              "excludes": ["OpenGL.GL", "Numeric", "copyreg", "itertools.imap", "numpy", "pkg_resources", "queue", "winreg", "pygame.SRCALPHA", "pygame.sdlmain_osx"],
              }
          }
      )

So, if you have similar issues, just put those "missing" modules into this "excludes" line.

2nd part:

After I succeeded in making of executable file, I had next problem: "The application has requested the Runtime to terminate it in unusual way. Please contact...". After days and days of searching and thinking how to solve this another problem, I found a way to do it. I couldn't believe that the problem was so absurd. The problem was in my code, with font definition:

font1 = pygame.font.SysFont(None, 13)

After changing "None" to some system font name (for an example "Arial" (must be a string)), and compiling, I couldn't believe that my .exe file worked!

font1 = pygame.font.SysFont("Arial", 13)

Of course, you can use your own font, but you must specify its path and define it in your program.

So for all of you who are experiencing this issues, try this steps and I hope that you will succeed. I really hope that this will help you, because I've lost days and weeks trying to solve these problems. I even tried making my .exe file with all versions of python and pygame, with many other .exe builders and setup scripts, but without luck. Besides these problems, I had many other problems before but I found answers to them on stackoverflow.com.

I'm happy that I found a way to solve this problems and to help you if you are faced with the same ones.

Small tips (things I've also done):

1st: update your Microsoft Visual C++ library to the latest one.

2nd: if you have images or fonts similar that your executable program needs, include them to dist folder (where your .exe file has been created).

3rd: when you are making your .exe file, include all needed files to the folder where your setup.py script is (all files and directories that your main script uses).

Used Python 2.7 x64, pygame and py2exe.

Don't use gui2exe use this file from this link: http://pygame.org/wiki/Pygame2exe

Follow the instructions and modify the file as needed. Place the file in the same directory as the "game" main and run the file from console.

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