error in exception syntax

Peter Otten __peter__ at web.de
Wed Mar 9 13:21:44 EST 2011


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/





More information about the Python-list mailing list