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

Re: [pygame] cx_Freeze and Pygame Font module



Hi,

On 05/01/12 02:16 PM, Nick Arnoeyts wrote:
Hey everyone

I'm trying to get to know cx_freeze as an alternative to py2exe but I've run into some problems. There don't seem to be any errors in creating the exe, however when running the exe there are complaints about missing modules and DLL Load Errors (see below for the error message).

I am using Python 2.7 (32-bit) on Windows 7 SP1 (64-bit). Tell me if there is anything else I have to post and I will do my best.

Thanks in advance for your help.

------------------------------

D:\home\Dropbox\code\eclipse-workspace\TestGame01\build\exe.win32-2.7>main
main:1: RuntimeWarning: import display: No module named _view
(ImportError: No module named _view)
main:1: RuntimeWarning: import draw: No module named _view
(ImportError: No module named _view)
main:1: RuntimeWarning: import image: No module named _view
(ImportError: No module named _view)
main:1: RuntimeWarning: import pixelcopy: No module named _view
(ImportError: No module named _view)
main:1: RuntimeWarning: import transform: No module named _view
(ImportError: No module named _view)
main:10: RuntimeWarning: use font: DLL load failed: %1 is not a valid Win32 appl
ication.
(ImportError: DLL load failed: %1 is not a valid Win32 application.)
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
    exec code in m.__dict__
  File "main.py", line 10, in <module>
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 70, in __getattr
__
    raise NotImplementedError(MissingPygameModule)
NotImplementedError: font module not available
(ImportError: DLL load failed: %1 is not a valid Win32 application.)
Oops, I better add a token _view import to the Pygame package __init__.py.

In lib\__init__.py, near the bottom, is a "def package_imports():" with a bunch of import statements in the body. Add an import "pygame._view" to the end of the list. This should be picked up by cx_freeze and get _view included in the package. I will fix this in the repository soon.

Module _view adds a wrapper class that exposes Surface data with a NumPy style array interface. It is used by surfarray.

Lenard Lindstrom