Re: [PyOpenGL-Users] PyOpenGL, GLUT, and MacOS X
Brought to you by:
mcfletch
|
From: Rene D. <il...@ya...> - 2003-08-09 13:37:16
|
T.J. Jankun-Kelly wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Greetings,
>
> I am using PyOpenGL 2.0.1.04 on Mac OS X 10.2 and Python 2.3
> (MacPython). When using some of the demos, I notice errors appear.
> For example, when running the demo in Demo/twburton:
> # pythonw knot.py
> Traceback (most recent call last):
> File
> "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
> packages/OpenGL/Demo/twburton/knot.py", line 239, in ?
> views.append(knotView(file))
> File
> "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
> packages/OpenGL/Demo/twburton/knot.py", line 115, in __init__
> self.knot = loadKnot(filename)
> File
> "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
> packages/OpenGL/Demo/twburton/knot.py", line 18, in loadKnot
> f = open(filename)
> IOError: [Errno 2] No such file or directory: '8.10'
>
> However, there is a file called 8.10 that exists. Upon further
> experimentation, I discovered the following. Say I start python from
> my home directory:
> # python
> Python 2.3 (#2, Jul 30 2003, 11:45:28)
> [GCC 3.1 20020420 (prerelease)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os,sys
> >>> os.system('pwd')
> /Users/tjk
> 0
> >>> from OpenGL.GLUT import *
> >>> glutInit(sys.argv)
> ['']
> >>> os.system('pwd')
> /usr/local/bin
> 0
> >>>
>
> I.e., after I run glutInit, the path has changed, so references to
> files in the "current" (current before the call to glutInit) will fail.
>
> Is this supposed to happen? Or is this a bug? Any quick workarounds?
Here's a work around.
old_cwd = os.path.realpath( os.curdir )
glutInit(sys.argv)
os.chdir(old_cwd)
|