I want to catch an exception, but I don't know its fully qualified name. I would like to figure it out experimentally without digging thru documentation.
Let's say I have code that looks like this
try:
blackbox()
except Exception,e:
print str(e)
print e.__class__.__name__
And it runs and I get an exception message that says
"error: too big"
error
So I add a handler
try:
blackbox()
except error,e:
pass
except Exception,e:
print str(e)
print e.__class__.__name__
but it doesn't work, because error is not in the current namespace. (I know the answer to this particular question, it happens to be curses.error). How I figure out the namespace of an exception object (i.e. curses. so I can add a handler for that exception?