How to raise an exception in one except block and catch it in a later except block in Python?
I would like to know if it is possible in python to raise an exception in one except block and catch it in a later except block. I have tried to implement this in code below, however it is not working.
try:
something
except SpecificError, ex:
if str(ex) = "some error I am expecting"
print "close softly"
else:
raise
except Exception, ex:
print "did not close softly"
raise
I want the raise in the else clause to trigger the final except statement.
How to catch the exception in a later except block?