Re: [PyOpenGL-Users] py2exe and pyopengl?
Brought to you by:
mcfletch
|
From: Craig B. <cd...@gm...> - 2010-02-17 03:40:35
|
Okay, neither of the provided recipe variants worked.
I have this at the top of my main.py, the main module:
import sys
sys.path.insert(0, '.')
import OpenGL.GL
import OpenGL.GLU
import OpenGL.GLUT
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
And here is my setup.py:
from distutils.core import setup
import py2exe, os, sys
setup(windows=['main.py'],
options={"py2exe":
{"includes": ["ctypes", "logging"],
"excludes": ["OpenGL"],
}
}
)
if sys.platform.startswith( "win" ) and "py2exe" in sys.argv:
# See http://www.py2exe.org/index.cgi/PyOpenGL
import OpenGL
import shutil
print "*** copy PyOpenGL module ***"
opengl_dir = os.path.dirname( OpenGL.__file__ )
try:
# Since the ignore keyword was introduced in Python 2.6, include a
# fall-back for Python 2.5.
try:
shutil.copytree( opengl_dir, os.path.join( "dist",
"OpenGL" ), ignore = shutil.ignore_patterns( "*.py", "*.pyc", "GLUT",
"Tk" ) )
except TypeError:
shutil.copytree( opengl_dir, os.path.join( "dist", "OpenGL" ) )
except WindowsError, error:
if not "already exists" in str( error ):
raise
When I run "python setup.py py2exe", the output includes this:
The following modules appear to be missing
['OpenGL.GL', 'OpenGL.GLU', 'OpenGL.GLUT']
...which is confusing, as that's why I did the imports in main.py
shown above. But anyway, the dist dir gets created, and the OpenGL
package is copied into it as expected. But when I run dist\main.exe,
I get an error popup pointing me at main.exe.log, which has these
contents:
Traceback (most recent call last):
File "main.py", line 6, in <module>
import OpenGL.platform.win32
ImportError: No module named OpenGL.platform.win32
Traceback (most recent call last):
File "main.py", line 6, in <module>
ImportError: No module named OpenGL.platform.win32
Traceback (most recent call last):
File "main.py", line 6, in <module>
import OpenGL.GL
ImportError: No module named OpenGL.GL
Traceback (most recent call last):
File "main.py", line 6, in <module>
ImportError: No module named OpenGL.GL
Ideas, please?
--
Craig Berry - http://www.cine.net/~cberry/
"Lots of things in the universe don’t solve any problems, and
nevertheless exist." -- Sean Carroll
|