Help resolve a syntax error on 'as' keyword (python 2.5)

Gabriel Genellina gagsl-py2 at
Wed Nov 4 01:57:00 CET 2009

En Tue, 03 Nov 2009 10:06:24 -0300, Oltmans <rolf.oltmans at>  

> Hi, all. All I'm trying to do is to print the error message using the
> following code (copying/pasting from IDLE).
> try:
>     div(5,0)
> except Exception as msg:
>     print msg
> SyntaxError: invalid syntax
> I'm using Python 2.5 on Windows XP.

Other people already told you what the problem is.
I suggest reading a book/tutorial written for the *same* Python version  
you're using (2.x; it doesn't matter 2.6, 2.5, 2.4...).
Once you know the basics of the language, you may look at the differences  
in the "What's new?" document for Python 3.0 - but right now, they will  
just confuse you.

Gabriel Genellina

More information about the Python-list mailing list