bug in urllib2/python23 ?
Achim Domma
domma at procoders.net
Fri Jun 20 03:44:15 EDT 2003
Hi,
the following lines
import urllib2
urllib2.urlopen('http://fr.allafrica.com/health/newswire')
produce the following backtrace on my computer:
File "D:\Python23\lib\urllib2.py", line 136, in urlopen
return _opener.open(url, data)
File "D:\Python23\lib\urllib2.py", line 330, in open
'_open', req)
File "D:\Python23\lib\urllib2.py", line 309, in _call_chain
result = func(*args)
File "D:\Python23\lib\urllib2.py", line 824, in http_open
return self.do_open(httplib.HTTP, req)
File "D:\Python23\lib\urllib2.py", line 818, in do_open
return self.parent.error('http', req, fp, code, msg, hdrs)
File "D:\Python23\lib\urllib2.py", line 350, in error
result = self._call_chain(*args)
File "D:\Python23\lib\urllib2.py", line 309, in _call_chain
result = func(*args)
File "D:\Python23\lib\urllib2.py", line 447, in http_error_302
new = self.redirect_request(req, fp, code, msg, headers)
File "D:\Python23\lib\urllib2.py", line 421, in redirect_request
if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or
File "D:\Python23\lib\urllib2.py", line 208, in __getattr__
raise AttributeError, attr
AttributeError: method
If I add a trailing slash to the url, everything works fine. Looks like a
bug to me!? Or is there a reason for this behaviour? If yes, how could I
decide wether I have to add a slash or not?
regards,
Achim
More information about the Python-list
mailing list