Issue 816787: urllib2.URLError don't calll IOError.init (original) (raw)

Created on 2003-10-02 20:16 by tebeka, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (4)
msg44729 - (view) Author: Miki Tebeka (tebeka) * Date: 2003-10-02 20:16
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__
msg44730 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2003-10-06 05:10
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?
msg44731 - (view) Author: John J Lee (jjlee) Date: 2005-05-19 21:10
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.
msg44732 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-12 01:35
Closing, per jjlee's suggestion.
History
Date User Action Args
2022-04-10 16:11:34 admin set github: 39356
2003-10-02 20:16:07 tebeka create