#49 Problem with py2exe and pyopengl using python2.3

closed-invalid
nobody
None
5
2004-05-14
2004-05-12
Anonymous
No

I have a package that uses pyopengl that used to work
with py2exe about a year ago. Now when I type:

python setup.py py2exe --excludes OpenGL

py2exe exits with:
The following modules appear to be missing
['OpenGL.GL', 'OpenGL.GLU', 'OpenGL.GLUT']

And the application terminates and tells me to check
the log file. The log file reports...
ImportError: No module named OpenGL.GL

Even though I have copied the OpenGL package into the
dist directory.

I thought that the --excludes switch was supposed to
tell py2exe to ignore the OpenGL modules and that they
would be loaded from the OpenGL directories that I
include within the 'dist' directory.

If you need more information you can contact me at:
chris.schafREMOVE@verizon.net

I also tried py2exe on the dot.py example in the
py2exesample.tar.gz file but it failed for other reasons.

Discussion

  • Thomas Heller

    Thomas Heller - 2004-05-13

    Logged In: YES
    user_id=11105

    You said you have copied the OpenGL package into the dist
    directory, and your exe can't import it.
    Have you made sure that the dist directory is on sys.path?
    By default, it isn't. See also:

    http://starship.python.net/crew/theller/moin.cgi/Py2exeEnvironment

     
  • Nobody/Anonymous

    Logged In: NO

    After a bit more experimentation I figured out how to get
    py2exe v0.5 and pyopengl to work together.

    At the top of any application that uses pyopengl add:

    import sys,os
    appPath = os.getcwd()
    sys.path.insert(0,appPath)

    And then copy the OpenGL directory tree into the .\dist
    directory created by py2exe.

    When a py2exe packaged application starts it has only one
    entry in its library search path. The above code inserts
    the applications path into the library search list before
    the 'library.zip' package that py2exe creates. Once you do
    this, everything works.

     
  • Chris Schafmeister

    Logged In: YES
    user_id=674111

    At first I was appending the dist directory to the sys.path
    list and nothing worked.

    On a lark, I tried inserting the dist directory as the first
    element of the sys.path list before the 'library.zip' entry
    and then everything worked.

     
  • Thomas Heller

    Thomas Heller - 2004-05-14

    Logged In: YES
    user_id=11105

    I don't know why this is so, but if it works for you it's great.
    I'll close this.

     
  • Thomas Heller

    Thomas Heller - 2004-05-14
    • status: open --> closed-invalid
     

Log in to post a comment.