[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] EXE Problem



Hello. Rejoining the list for a little while at least. [Re-sending this now that I'm actually on the list.]

I'm working on a Pygame project. It works fine in IDLE and running
directly from Windows (double-clicking on the .py file). I'm using WinXP, Python 2.6 and/or 2.5.

I want to build an EXE to distribute. I've done this before, using
py2exe, probably back around the time I had Python 2.3. Now, I can build
an EXE, but it crashes on running. This happens no matter what program
or method I use, so I'm getting frustrated. Below are details of my
problem. What am I doing wrong? I'm totally unable to distribute my
programs, even a minimal one designed to test this problem. Should I try
reverting to an earlier version of Python and Pygame?

Short version: Py2exe builds an EXE that crashes due to something about a missing mixer and font module. Pygame2exe does the same, but nicely packaged. BBFreeze installed with much difficulty, then complained about one of its own files/modules being missing.

Details:

Using Py2exe with the command line "python setup.py py2exe" and the setup.py:

[
# setup.py
from distutils.core import setup
import py2exe
import pygame.mixer
setup(console=["morningside_server.py"]) ## My main program's file
]

I get this error:

[
C:\Python26\dist\morningside_server.exe\ringtale.py:65: RuntimeWarning:
use mixer: MemoryLoadLibrary failed loading pygame\mixer.pyd
(ImportError: MemoryLoadLibrary failed loading pygame\mixer.pyd)
Traceback (most recent call last):
  File "morningside_server.py", line 30, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "ringtale.pyo", line 65, in <module>
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: mixer module not available
(ImportError: MemoryLoadLibrary failed loading pygame\mixer.pyd)
]

This error can be corrected by copying the file "libogg-0.dll" into the
dist directory where the EXE goes. Now the error becomes:

[
C:\Python26\dist\morningside_server.exe\art.py:119: RuntimeWarning: use
font: MemoryLoadLibrary failed loading pygame\font.pyd
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
Traceback (most recent call last):
  File "morningside_server.py", line 32, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "art.pyo", line 119, in <module>
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: font module not available
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
]

I also tried this setup.py file:
[
# setup.py
from distutils.core import setup
import py2exe
import pygame.mixer
setup(console=["morningside_server.py"],
      options={
          "py2exe":{
              "includes":["pygame.mixer"]
              }
          }
      )
]

I guessed that maybe it was now just missing "libttf.dll", so I tried
copying that as well. But it's already present.

I tried the alternative program "bbfreeze", and after a great deal of
difficulty installing it, got this error:
[
File "C:\python26\scripts\bbfreeze.egg\bbfreeze\freezer.py", line 384,
in _entry_script
IOError: [Errno 2] No such file or directory: 'bdist_bbfreeze'
]

Using this script for it, based on the program's own description page:
[
from bbfreeze import Freezer
f = Freezer("morningside_server")
f.include_py = False
f.addScript("morningside_server.py")
f()
]

I tried a minimal Pygame program just now with Py2exe, viz:
[
## Test program
import pygame
pygame.init()
screen = pygame.display.set_mode((640,480))
f = pygame.font.Font("EagerNaturalist.ttf",32) ## I put this font into the dist directory -- works fine in IDLE
text = f.render("Some Text",32,(255,255,255))
screen.blit(text,(100,100))
pygame.display.update()
]

And the same thing happens:
[
NotImplementedError: font module not available
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
]
So it's not due to the complexities of my particular project.


Any help would be appreciated.