error in exception syntax

Discussion in 'Python' started by Aaron Gray, Mar 9, 2011.

  1. Aaron Gray

    Aaron Gray Guest

    On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting the
    following error :-

    File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    except OSError, err:
    ^

    It works okay on my Linux machine running Python 2.6.2.

    Many thanks in advance,

    Aaron
    Aaron Gray, Mar 9, 2011
    #1
    1. Advertising

  2. Aaron Gray

    Alex Willmer Guest

    On Mar 9, 6:12 pm, "Aaron Gray" <> wrote:
    > On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting the
    > following error :-
    >
    >     File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    >       except OSError, err:
    >                 ^
    >
    > It works okay on my Linux machine running Python 2.6.2.


    Python 3.x is a different beast to Python 2.x. It has a number of
    backward incompatible changes, including the try/except syntax.
    Install the latest Python 2.x (Python 2.7) on your Windows machine and
    use that. Then read http://docs.python.org/release/3.2/whatsnew/3.0.html

    Regards, Alex
    Alex Willmer, Mar 9, 2011
    #2
    1. Advertising

  3. Aaron Gray

    Peter Otten Guest

    Aaron Gray wrote:

    > On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting
    > the following error :-
    >
    > File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    > except OSError, err:
    > ^
    >
    > It works okay on my Linux machine running Python 2.6.2.
    >
    > Many thanks in advance,


    Use

    try:
    ...
    except OSError as err:
    ...

    This will work in both 2.6 and 3.x. If you are interested in the reasons for
    this change see

    http://www.python.org/dev/peps/pep-3110/
    Peter Otten, Mar 9, 2011
    #3
  4. Aaron Gray

    MRAB Guest

    On 09/03/2011 18:12, Aaron Gray wrote:
    > On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting
    > the following error :-
    >
    > File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    > except OSError, err:
    > ^
    >
    > It works okay on my Linux machine running Python 2.6.2.
    >
    > Many thanks in advance,
    >
    > Aaron
    >

    In Python 3 the syntax is:

    except OSError as err:

    Are you sure that that version of OpenGL compatible with Python 3?
    MRAB, Mar 9, 2011
    #4
  5. Aaron Gray

    Tim Golden Guest

    On 09/03/2011 6:12 PM, Aaron Gray wrote:
    > On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting the
    > following error :-
    >
    > File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    > except OSError, err:
    > ^
    >
    > It works okay on my Linux machine running Python 2.6.2.


    In short:

    http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changes-to-exceptions

    TJG
    Tim Golden, Mar 9, 2011
    #5
  6. Aaron Gray

    Aaron Gray Guest

    "Aaron Gray" <> wrote in message
    news:...
    > On Windows I have installed Python 3.2 and PyOpenGL-3.0.1 and am getting
    > the following error :-
    >
    > File "c:\Python32\lib\site-packages\OpenGL\platform\win32.py", line 13
    > except OSError, err:
    > ^
    >
    > It works okay on my Linux machine running Python 2.6.2.


    Many thanks,

    Aaron
    Aaron Gray, Mar 9, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Balaji
    Replies:
    3
    Views:
    10,077
  2. gabriele renzi
    Replies:
    2
    Views:
    194
    gabriele renzi
    Dec 31, 2005
  3. Good Night Moon
    Replies:
    9
    Views:
    267
    Rick DeNatale
    Jul 25, 2007
  4. Mark Richards
    Replies:
    3
    Views:
    304
    Tad McClellan
    Nov 18, 2007
  5. friend
    Replies:
    1
    Views:
    198
    Thomas 'PointedEars' Lahn
    May 12, 2008
Loading...

Share This Page