[ python-Bugs-1429783 ] urllib.py: AttributeError on BadStatusLine
SourceForge.net
noreply at sourceforge.net
Wed Mar 14 09:29:28 CET 2007
Bugs item #1429783, was opened at 2006-02-11 18:15
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1429783&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: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: kxroberto (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.py: AttributeError on BadStatusLine
Initial Comment:
PythonWin 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC
v.1200 32 bit (Intel)] on win32.
in httplib errcode -1 &
file=self._conn.sock.makefile('rb', 0) is returned on
Badstatusline:
except BadStatusLine, e:
### hmm. if getresponse() ever closes the
socket on a bad request,
### then we are going to have problems with
self.sock
### should we keep this behavior? do people
use it?
# keep the socket open (as a file), and
return it
self.file = self._conn.sock.makefile('rb', 0)
# close our socket -- we want to restart
after any protocol error
self.close()
self.headers = None
return -1, e.line, None
fp = h.getfile()
delivers None in urllib.URLopener.open_http
and this is traceback leading to an AttributeError
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\lib\urllib.py", line 181, in open
return getattr(self, name)(url)
File "C:\Python23\lib\urllib.py", line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
File "C:\Python23\lib\urllib.py", line 319, in http_error
result = method(url, fp, errcode, errmsg, headers)
File "C:\Python23\lib\urllib.py", line 584, in
http_error_301
return self.http_error_302(url, fp, errcode,
errmsg, headers, data)
File "C:\Python23\lib\urllib.py", line 565, in
http_error_302
data)
File "C:\Python23\lib\urllib.py", line 580, in
redirect_internal
return self.open(newurl)
File "C:\Python23\lib\urllib.py", line 181, in open
return getattr(self, name)(url)
File "C:\Python23\lib\urllib.py", line 306, in open_http
return self.http_error(url, fp, errcode, errmsg,
headers)
File "C:\Python23\lib\urllib.py", line 323, in http_error
return self.http_error_default(url, fp, errcode,
errmsg, headers)
File "C:\Python23\lib\urllib.py", line 327, in
http_error_default
void = fp.read()
AttributeError: 'NoneType' object has no attribute 'read'
As I get this error rarely I cannot reproduce exactly how
self._conn.sock.makefile('rb', 0)
delivers None in that case.
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-14 08:29
Message:
Logged In: YES
user_id=849994
Originator: NO
Fixed that bug finally in rev. 54376, 54377 (2.5).
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-12 06:56
Message:
Logged In: YES
user_id=33168
I should add that the other bug is still open.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-02-12 06:55
Message:
Logged In: YES
user_id=33168
This may be a duplicate of a bug submitted by Bram Cohen.
It was a couple of years ago and I don't remember any other
details.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1429783&group_id=5470
More information about the Python-bugs-list
mailing list