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

Re: [pygame] py2exe



If py2exe didn't detect them, it wouldn't know to give you an error about it (nor would it include them). This happens for imports done in C, or done without the import bytecode (e.g. __import__ or the imp module).

This is a common problem with py2exe, because several popular packages do one of these things, and several core modules do as well. py2app works around the problem by including package-specific code that knows how to deal with the various projects (e.g. include pygame's font, include PIL plugins, etc.). Of course, not too useful for a Windows user, but the code is out there so it would be relatively trivial for someone to look at py2app and bring its ideas into py2exe (or cx_Freeze).

-bob

On Sep 18, 2005, at 10:49 PM, D. Hartley wrote:

Bob,

Thanks for that, it's very helpful! What if you legitimately had
modules you needed to include but py2exe didn't detect them?

~Denise


On 9/18/05, Bob Ippolito <bob@xxxxxxxxxx> wrote:

py2exe missing modules warnings are usually spurious.  Ignore then
unless your application doesn't work.

This is why py2app doesn't bother reporting about "missing modules"
because it's almost never a legitimate error.

-bob

On Sep 18, 2005, at 10:26 PM, D. Hartley wrote:


Kris,

Yep. It tells me the same list of modules -('AppKit', 'Foundation',
'Numeric', 'OpenGL.GL', 'objc', 'pygame.movie',
 'pygame.movieext', 'pygame.overlay') - is missing.

I can still run the .exe, and on this very simple example, it doesn't
seem to *matter* that those modules are missing. But shouldn't I be
concerned, regardless? Wouldn't there be some situations where those
modules WOULD matter, or if not, why raise an error over them? Some of
them sound like they could be important.


How can I force it to include them? Can I? Does anyone know?

Thanks,
Denise



On 9/18/05, Kris Schnee <kschnee@xxxxxxxxxx> wrote:


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