Beginner Python OpenGL difficulties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jg.campbell.ng@gmail.com

    #1

    Beginner Python OpenGL difficulties

    I'm beginning learning Python and OpenGL in Python.

    Python fine. But difficulties with OpenGL; presumably with the
    installation of OpenGL.

    OS = Linux FC5.

    Python program gl_test.py:

    from OpenGL.GLUT import *
    from OpenGL.GLU import *
    from OpenGL.GL import *

    name = "Hello, World"
    height = 400
    etc.

    jc@localhost~/etc/python>$ python2 gl_test.py

    Traceback (most recent call last):
    File "gl_test.py ", line 1, in ?
    from OpenGL.GLUT import *
    ImportError: No module named OpenGL.GLUT

    jc@localhost~/etc/python>$ echo $PYTHONPATH
    /usr/lib/python2.2/site-packages/OpenGL

    jc@localhost/usr/lib/python2.2/site-packages/OpenGL>$ ll
    total 1076
    drwxr-xr-x 13 root root 4096 May 28 15:17 Demo/
    drwxr-xr-x 3 root root 4096 May 28 15:17 doc/
    drwxr-xr-x 25 root root 4096 May 28 15:17 GL/
    -rwxr-xr-x 1 root root 624927 Jan 2 2005 GLE.so*
    drwxr-xr-x 4 root root 4096 May 28 15:17 GLU/
    -rwxr-xr-x 1 root root 312612 Jan 2 2005 GLUT.so*
    drwxr-xr-x 6 root root 4096 May 28 15:17 GLX/
    -rw-r--r-- 1 root root 868 Mar 12 2004 __init__.py
    -rw-r--r-- 1 root root 1466 Jan 2 2005 __init__.pyc
    etc ...

    Any suggestions.

    TIA,

    Jon C.

  • Mike C. Fletcher

    #2
    Re: Beginner Python OpenGL difficulties

    jg.campbell.ng@ gmail.com wrote:[color=blue]
    > I'm beginning learning Python and OpenGL in Python.
    >
    > Python fine. But difficulties with OpenGL; presumably with the
    > installation of OpenGL.
    >
    > OS = Linux FC5.
    >
    > Python program gl_test.py:
    >
    > from OpenGL.GLUT import *
    > from OpenGL.GLU import *
    > from OpenGL.GL import *
    >
    > name = "Hello, World"
    > height = 400
    > etc.
    >
    > jc@localhost~/etc/python>$ python2 gl_test.py
    >
    > Traceback (most recent call last):
    > File "gl_test.py ", line 1, in ?
    > from OpenGL.GLUT import *
    > ImportError: No module named OpenGL.GLUT
    >
    > jc@localhost~/etc/python>$ echo $PYTHONPATH
    > /usr/lib/python2.2/site-packages/OpenGL
    >[/color]
    You should already have site-packages in your PythonPath. You want the
    directory *above* OpenGL in the path, not OpenGL itself. I'm unsure why
    you're running a Python 2.2 instance on a modern Linux. I'd suspect
    that you're using an RPM for an older Linux? Not sure there, I run
    Gentoo, so everything builds from source for the packages that are
    installed. There are some Fedora Core build patches in CVS that are
    waiting for me to get my posterior in gear with Win32 testing to be
    released. Not sure if that would change anything for you, though.

    Good luck,
    Mike

    --
    _______________ _______________ _______________ ___
    Mike C. Fletcher
    Designer, VR Plumber, Coder



    Comment

    • jg.campbell.ng@gmail.com

      #3
      Re: Beginner Python OpenGL difficulties


      Mike C. Fletcher wrote:[color=blue]
      > jg.campbell.ng@ gmail.com wrote:[color=green]
      > > I'm beginning learning Python and OpenGL in Python.
      > >[/color][/color]
      [...][color=blue][color=green]
      > > ImportError: No module named OpenGL.GLUT
      > >
      > > jc@localhost~/etc/python>$ echo $PYTHONPATH
      > > /usr/lib/python2.2/site-packages/OpenGL
      > >[/color]
      > You should already have site-packages in your PythonPath. You want the
      > directory *above* OpenGL in the path, not OpenGL itself.[/color]

      Yes, tried that:

      $ echo $PYTHONPATH
      /usr/lib/python2.2/site-packages/

      and no improvement. Should there be a file or directory named GLUT* in
      /usr/lib/python2.2/site-packages/OpenGL/ ? All I can see are GL, GLU
      and GLX directories.

      I'm unsure why[color=blue]
      > you're running a Python 2.2 instance on a modern Linux.[/color]

      jc@localhost~/etc/python>$ python2
      Python 2.4.2 (#1, Feb 12 2006, 03:59:46)
      [GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2

      The OpenGL stuff was from an RPM that I sound on the web.

      Many thanks,

      Jon C.

      Comment

      • Diez B. Roggisch

        #4
        Re: Beginner Python OpenGL difficulties

        jg.campbell.ng@ gmail.com wrote:
        [color=blue]
        >
        > Mike C. Fletcher wrote:[color=green]
        >> jg.campbell.ng@ gmail.com wrote:[color=darkred]
        >> > I'm beginning learning Python and OpenGL in Python.
        >> >[/color][/color]
        > [...][color=green][color=darkred]
        >> > ImportError: No module named OpenGL.GLUT
        >> >
        >> > jc@localhost~/etc/python>$ echo $PYTHONPATH
        >> > /usr/lib/python2.2/site-packages/OpenGL
        >> >[/color]
        >> You should already have site-packages in your PythonPath. You want the
        >> directory *above* OpenGL in the path, not OpenGL itself.[/color]
        >
        > Yes, tried that:
        >
        > $ echo $PYTHONPATH
        > /usr/lib/python2.2/site-packages/
        >
        > and no improvement. Should there be a file or directory named GLUT* in
        > /usr/lib/python2.2/site-packages/OpenGL/ ? All I can see are GL, GLU
        > and GLX directories.
        >
        > I'm unsure why[color=green]
        >> you're running a Python 2.2 instance on a modern Linux.[/color]
        >
        > jc@localhost~/etc/python>$ python2
        > Python 2.4.2 (#1, Feb 12 2006, 03:59:46)
        > [GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2
        >
        > The OpenGL stuff was from an RPM that I sound on the web.[/color]

        Go compile it yourself then - the RPM seems to be for python2.2, but you run
        2.4. That means more happened than just changing the PYTHONPATH - so don't
        expect you come away so cheap :)

        Diez

        Comment

        Working...