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

Re: [pygame] py2exe



Best is to first understand why those warning happen:

let's take an example: imagine you have the following code snippet deep inside one of the library you use for your game

if os.name == 'macosx':
    import Foundation as mod
else:
    import defaultmod as mod

When analyzing the module for inclusion in the "library.zip", py2exe looks for all import statement in the files.

As it is in the case above, some import statement are meaningful only in the case of a certain operating system, but it will still be analyzed by py2exe as necessary. So in the end, the module that probably does not even exist on your OS cannot be found by py2exe and will be left out of the final executable.

You can have another case of problems that can happen with py2exe.

Some modules (such as the excellent cElementTree) are built entirely from a C library and directly call native Python APIs to import other modules. Such things, py2exe cannot detect them and the only way for py2exe to find then out and include them will be to import them manually in the main source file for example.

I don't fully explain why you get errors with pygame.movie etc. but you could try to import them directly like this if the need ever arise:

from pygame import movie
from pygame import movieext
from pygame import overlay

Regards,

Guillaume