0

So I was trying to make my game in pyGame using pyOpenGL ready for distribution to friends who don't have either pyGame or pyOpenGL - so I ran such script using py2exe:

from distutils.core import setup
import py2exe

    setup(windows=['Menu.py'],
          options={
              "py2exe": {
                  "includes": ["ctypes", "logging"],
                  "excludes": ["OpenGL"],
                  }
              }
          )

which is what they advise at http://www.py2exe.org/index.cgi/PyOpenGL and later copied the OpenGL folder to the dist folder and the zip within it but I still get the same error:

Traceback (most recent call last):
  File "Menu.py", line 12, in <module>
  File ".\OpenGL\GL\__init__.py", line 3, in <module>
    from OpenGL import error as _error
  File ".\OpenGL\error.py", line 12, in <module>
    from OpenGL import platform, _configflags
  File ".\OpenGL\platform\__init__.py", line 35, in <module>
    _load()
  File ".\OpenGL\platform\__init__.py", line 26, in _load
    plugin_class = plugin.load()
  File ".\OpenGL\plugins.py", line 15, in load
    return importByName( self.import_path )
  File ".\OpenGL\plugins.py", line 35, in importByName
    module = __import__( ".".join(moduleName), {}, {}, moduleName)
  File ".\OpenGL\platform\win32.py", line 3, in <module>
    import platform
ImportError: No module named platform

I also tried pasting

import sys
sys.path += ['.']

at the top of Menu.py and then

from ctypes import util
try:
    from OpenGL.platform import win32
except AttributeError:
    pass

within it - as they also suggest - but to no avail either and the same error persists. How can I solve this?

Straightfw
  • 2,143
  • 5
  • 26
  • 39

1 Answers1

0

OK, so after a few days of fighting, I decided to try an alternative and so I found pyInstaller which I heartily recommend to everyone having trouble with pyGame + pyOpenGL to exe combo (which still looks impossible to me). It included absolutely everything, I had to prepare no setup scripts and all and pass no parameters either. pyInstaller for the win.

Straightfw
  • 2,143
  • 5
  • 26
  • 39