Parachute Segmentation Fault Error - pygame to py2exe

2.8k views Asked by At

I am using GUI2Exe to compile my python/pygame, game to a .exe

I have a problem with the font module.

using python 2.7 and the py2exe option in GUI2Exe I have updated python, pygame and py2exe with the 2.7 versions. My program runs fine but after I compile it with py2exe I get this.

Here is the error I get:

Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

My game starts off as a console and that part runs. But as soon as the display starts I get the crash.

Thanks

2

There are 2 answers

0
lbartolic On

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 (https://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.

0
user1473612 On

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.