Using a fresh install of PyOpenGL and svn checkout of pyinstaller I
recieved the following error when trying to run my gltest.exe:
blah, blah, blah ...
File "c:\Python25\pyinstaller\iu.py", line 433, in importHook
raise ImportError, "No module named %s" % fqname
ImportError: No module named OpenGL.platform.win32
A quick look in the PyOpenGL toplevel __init__.py reveals that it uses
some kind of conditional import mechanism depending on the platform it
finds itself running on. I added hook-OpenGL.py (below) to my
pyinstaller/hooks directory and my gltest app ran fine. I've read that
some people have had problems with pkg_resources and PyOpenGL but this
seems to have been fixed in recent versions of PyOpenGL (I think I
read this on the PyOpenGL site somewhere). In any case the only
problem I had with fresh installs of all components was the import
error that was fully solved by the hook file. I don't have time to
test it on another os but I see no reason why it shouldn't work.
########################################## pyinstaller/hooks/hook-
OpenGL.py
## The following appears in the toplevel OpenGL package __init__.py
## file on my installation:
#
# # Declarations of plugins provided by PyOpenGL itself
# from OpenGL.plugins import PlatformPlugin, FormatHandler
# PlatformPlugin( 'nt', 'OpenGL.platform.win32.Win32Platform' )
# PlatformPlugin( 'posix ', 'OpenGL.platform.glx.GLXPlatform' )
# PlatformPlugin( 'linux2', 'OpenGL.platform.glx.GLXPlatform' )
# PlatformPlugin( 'darwin',
'OpenGL.platform.darwin.DarwinPlatform' )
#
##
## PlatformPlugin apparently performs a conditional import based
## on os.name. pyinstaller misses this so lets add it ourselves...
from os import name
if name == 'nt' : hiddenimports = ['OpenGL.platform.win32']
elif name == 'posix ': hiddenimports = ['OpenGL.platform.glx']
elif name == 'linux2': hiddenimports = ['OpenGL.platform.glx']
elif name == 'darwin': hiddenimports = ['OpenGL.platform.darwin']
else: print "ERROR: hook-OpenGL: Unrecognised os.name"
########################################## pyinstaller/hooks/hook-
OpenGL.py
I hope this is useful to someone.
Thanks,
Oscar.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---