[Patches] [ python-Patches-1619247 ] fix urllib to raise IOError correctly

SourceForge.net noreply at sourceforge.net
Wed Dec 20 09:16:30 CET 2006


Patches item #1619247, was opened at 2006-12-20 06:42
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1619247&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
>Status: Closed
>Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Dug Song (dugsong)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix urllib to raise IOError correctly

Initial Comment:
urllib.URLopener's http_error_default() is supposed to raise IOError on failure, but does this with an invalid number of arguments, resulting in a TypeError:

  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 357, in http_error_default
    raise IOError('http error', errcode, errmsg, headers)
TypeError: EnvironmentError expected at most 3 arguments, got 4

removing the extraneous "headers" argument, the raised exception works as intended:

  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 357, in http_error_default
    raise IOError, ('http error', errcode, errmsg)
IOError: [Errno http error] 401: 'Unauthorized'


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-12-20 08:16

Message:
Logged In: YES 
user_id=849994
Originator: NO

Thanks for reporting, this was already fixed in response to bug #1566800.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1619247&group_id=5470


More information about the Patches mailing list