Menu

#127 py2exe fails missing "version" file in OpenGL/__init__.py

v2.0.1
open
nobody
install (16)
5
2005-02-21
2005-02-21
No

In OpenGL/__init__.py you find out the current version
by doing:
filename = os.path.join(os.path.dirname(__file__),
'version')
__version__ = string.strip(open(filename).read())

However, once things are packed up by py2exe,
__init__.py is actually inside a zipfile, and there is
no "version" file for it to read.

The easiest fix that I've found is to just wrap the
above in a try/except block, and use whatever the
current version should be.

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

Even if you did something that indicated an "unknown"
version, or something else, it would be nice to have
pyOpenGL work out of the box when packed up.

Thanks,
John

Discussion

  • Giovanni Bajo

    Giovanni Bajo - 2005-08-23

    Logged In: YES
    user_id=727687

    I have the very same problem. Can we get a fix for this bug?

     
  • Giovanni Bajo

    Giovanni Bajo - 2008-02-25

    Logged In: YES
    user_id=727687
    Originator: NO

    I'll notice that PyInstaller has a stable workaround for this bug, so it can be used with stock PyOpenGL.

     

Log in to post a comment.