[New-bugs-announce] [issue4250] urllib2.py: HTTPResponse instance has no attribute 'code'

Jon Perez report at bugs.python.org
Sun Nov 2 15:57:17 CET 2008


New submission from Jon Perez <jbperez808 at yahoo.com>:

In http_response() in HTTPErrorProcessor in urllib2.py, the following line

code, msg, hdrs = response.code, response.msg, response.info()

results in an error because response.code is not a valid
attribute, changing it to response.status works, but is
this the correct bug fix?



See
http://www.linuxquestions.org/questions/linux-newbie-8/problem-with-yum-fedora-9-670586/

Traceback (most recent call last):
File "/usr/bin/yum", line 30, in <module>
yummain.main(sys.argv[1:])
File "/usr/share/yum/yummain.py", line 233, in main
clientStuff.get_package_info_from_servers(serverlist, HeaderInfo)
File "/usr/share/yum/clientStuff.py", line 846, in
get_package_info_from_servers
progress_obj=None)
File "/usr/share/yum/clientStuff.py", line 1327, in grab
bandwidth, conf.retries, retrycodes, checkfunc)
File "/usr/share/yum/urlgrabber.py", line 237, in retrygrab
progress_obj, throttle, bandwidth)
File "/usr/share/yum/urlgrabber.py", line 314, in urlgrab
fo = urllib2.urlopen(url)
File "/usr/lib/python2.5/urllib2.py", line 121, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.5/urllib2.py", line 380, in open
response = meth(req, response)
File "/usr/lib/python2.5/urllib2.py", line 487, in http_response
code, msg, hdrs = response.code, response.msg, response.info()
AttributeError: HTTPResponse instance has no attribute 'code'

----------
components: Library (Lib)
messages: 75455
nosy: jbperz808
severity: normal
status: open
title: urllib2.py: HTTPResponse instance has no attribute 'code'
type: behavior
versions: Python 2.4, Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4250>
_______________________________________


More information about the New-bugs-announce mailing list