How to except the unexpected?

Ben Caradoc-Davies ben at wintersun.org
Fri Mar 3 19:11:36 EST 2006


James Stroud wrote:
> except URLError, HTTPException:

Aieee! This catches only URLError and binds the name HTTPException to 
the detail of that error. You must write

except (URLError, HTTPException):

to catch both.

-- 
Ben Caradoc-Davies <ben at wintersun.org>
http://wintersun.org/
"Those who deny freedom to others deserve it not for themselves."
- Abraham Lincoln



More information about the Python-list mailing list