[Python-bugs-list] [ python-Bugs-662099 ] urllib2 exceptions need improvement
SourceForge.net
noreply@sourceforge.net
Sat, 04 Jan 2003 16:32:57 -0800
Bugs item #662099, was opened at 2003-01-04 07:00
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=662099&group_id=5470
Category: Python Library
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Viehmann (t-v)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 exceptions need improvement
Initial Comment:
Hi.
Thanks for urllib2.
Urllib2 would be even better if Exceptions were more
unified, i.e. if there was way to test any URLException
for common failure causes, regardless of the protocol.
Example: 'File not found' can happen with
http/ftp/gopher/...
Cheers
Thomas
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-04 19:32
Message:
Logged In: YES
user_id=33168
Perhaps I'm missing something, but I don't understand what
you want. All the exceptions in urllib2 derive from
URLError, which itself derives from IOError. There are a
few cases where IOError is raised. All other cases raise
URLError, HTTPError, or GopherError. Isn't IOError (or
possibly URLError) what you are looking for?
So you would do:
try:
# your code here
except IOError:
# handle any urllib2 exception
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=662099&group_id=5470