[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] py2exe
D. Hartley wrote:
Hello, everyone!
Has anyone used py2exe with pygame games? I have managed to get it
These are my own notes on the subject:
In the main Python directory, run:
python setup.py py2exe
Where setup.py consists of:
# setup.py
from distutils.core import setup
import py2exe
setup(console=["MyProgram.py"])
And where all your .py files are in the main Python directory itself.
Mysterious errors I've seen:
-On running Py2exe, "The following modules appear to be missing:
Foundation, dotblas, objc." These don't seem to matter; I think they're
only used on Macs. Solution: Ignore.
-Run-time error: Invalid Tcl version, eg: "Version conflict -- have 8.4,
need 8.3." In this case the user had a programming language called Ruby
installed, which apparently jam's Tkinter, Python's version of/interface
to Tk, an interface system. (By the way, Python's IDE, IDLE, is itself
written in Tkinter, which can cause annoying problems in itself when
working with Tkinter.) Solution: Delete Ruby.
-Run-time error: Something about fonts. Voodoo solution: Find
"FREESANSBOLD.TTF" in your Windows directory and copy it into the dist
directory.
-Run-time error: Segmentation fault involving Pygame's "sndarray.pyc."
Solution: Destroy Python's "dist" and "build" directories, which
probably are being used to load all sorts of gunk from other programs
you've written into this EXE and somehow interfering with it.
-Run-time error: Can't load file. If you have media like graphics and
music, make sure they're all there in the dist directory with whatever
directory structure you tested the program in.
-----
I don't use any fancy setup.py for Pygame projects. I just build the
EXE, then transfer any relevant media files to the Dist directory manually.
Have you tried building a minimal Pygame program (eg. "import pygame;
pygame.init(); print "Foo!") into an EXE?
Kris