Quantcast
Channel: Adam Sherman » Python
Viewing all articles
Browse latest Browse all 6

Google App Engine’s Python Exception Syntax

$
0
0

Remember, Python 2.5 has this exception syntax:

try:
    raise FooException("Darn!")
except FooException, e
    print("Error: %s" % e)
The newer syntax is:
try:
    raise FooException("Darn!")
except FooException as e
    print("Error: %s" % e)
I ran into this when uploading an application to Google App Engine, which then produced this cryptic error:
<type 'exceptions.SyntaxError'>: invalid syntax (main.py, line 64)
Where line 64 is the line containing the not-yet-implemented as keyword.

Viewing all articles
Browse latest Browse all 6

Trending Articles