Thanks! the question is solved in all the answers given.
Original question follows:
given a traceback error log, i don't always know how to catch a particular exception.
my question is in general, how do i determine which "except" clause to write in order to handle a certain exception.
example 1:
File "c:\programs\python\lib\httplib.py", line 683, in connect
raise socket.error, msg
error: (10065, 'No route to host')
example 2:
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position(...)
catching the 2nd example is obvious:
try:
...
except UnicodeDecodeError:
...
how do i catch specifically the first error?