try... except with unknown error types
Yingjie.Lin at mssm.edu
Fri Aug 19 21:09:12 CEST 2011
Hi Python users,
I have been using try...except statements in the situations where I can expect a certain type of errors might occur.
But sometimes I don't exactly know the possible error types, or sometimes I just can't "spell" the error types correctly.
response = urlopen(urljoin(uri1, uri2))
print "URL does not exist!"
Though "urllib2.HTTPError" is the error type reported by Python, Python doesn't recognize it as an error type name.
I tried using "HTTPError" alone too, but that's not recognized either.
Does anyone know what error type I should put after the except statement? or even better: is there a way not to specify
the error types? Thank you.
More information about the Python-list