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

Re: [pygame] py2exe / OpenGL Build Trouble



"Kris Schnee" <kschnee@xxxxxxxxxx> wrote
> I just built an EXE using Pygame and PyOpenGL, and the EXE crashes with
> this message:
>
> Traceback (most recent call last):
>    File "cubeland.py", line 13, in ?
>    File "OpenGL\__init__.pyc", line 18, in ?
>    File "OpenGL\__init__.pyc", line 14, in __set_attributes
> IOError: [Errno 2] No such file or directory:
> 'C:\\Python24\\dist\\library.zip\\OpenGL\\version'
>
>
> What do I do about this problem?

I think it depends on what version of PyOpenGL and Py2EXE you have
installed - the documentation here seems to think it's no longer a
problem:

http://pyopengl.sourceforge.net/documentation/py2exe.html

However, I think that at one time I tinkered with my OpenGL module to get
around this. When I looked in
python24/lib/site-packages/OpenGL/__init__.py, I saw that it was trying to
open up a version file (and, looking at your stack trace, sounds like what
you're seeing too).

What I ended up doing was rewriting the __version__ assignment in
__init__.py, like so:

try:
    filename = os.path.join(os.path.dirname(__file__), 'version')
    __version__ = string.strip(open(filename).read())
except Exception,err:
    __version__ = '2.0.2.01'


Clearly a hack, but it's worked so far. You may want to verify what
version of PyOpenGL you have installed before you apply it to your own
machine.


It looks to me like the 3.x versions of PyOpenGL don't require this sort
of nonsense, if that's an option available to you.

-Dave LeCompte