[Python-bugs-list] Blank except block fails in try statement (PR#60)
wolfeman@apple.com
wolfeman@apple.com
Sat, 21 Aug 1999 20:46:33 -0400 (EDT)
Full_Name: Dan Wolfe
Version: 1.5.2/1.5.2b1
OS: Linux/MacOS
Submission from: a17-202-21-249.apple.com (17.202.21.249)
I ran into a situation with the try statement which I'm not sure is a bug or a
limitation that needs to be documented. When you have an empty except: block in
a try statement, both MacPython 1.5.2b1 and Linux Python 1.5.2 report that you
have invalid syntax.
The simplest form that recreates the error is:
try:
print "this is a test"
raise(error)
except:
### do nothing!
else:
print "pleasent dreams"
The easiest way to fix this is by adding a single line to the empty exception
block:
except:
### do nothing!
print "Dammit Spock, this is not logical!"