The comments says it's not needed by in the case of: --------------- from urllib2 import URLError u = URLError(1) u[-1] Traceback (most recent call last): File "u.py", line 6, in ? u[-1] AttributeError: URLError instance has no attribute 'args' -------------- it's not what we excpect. Attaching a patch to call IOError.__init__
Logged In: YES user_id=31392 I've changed URLError to call IOError.__init__(). That's an improvement, but it's still not great. The typical EnvironmentError has a two- or three-tuple where item 0 is the errno, item 1 is a string explaining the error, and item 3 is a filenumber. The change will creates args, but won't set errno or strerrror. Code expecting an errno in args[0] will be surprised. What do you think?
Logged In: YES user_id=261020 This should be closed: If anybody has any further bright ideas on making urllib2's exceptions more beautiful, they can always submit a new patch.