classification
Title: urllib2 httplib _read_chunked timeout
Type: behavior Stage: test needed
Components: Documentation, Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: ajaksu2, devloop, georg.brandl, jjlee, orsenthil
Priority: normal Keywords:

Created on 2006-08-09 15:00 by devloop, last changed 2009-02-13 10:53 by georg.brandl. This issue is now closed.

Messages (4)
msg60967 - (view) Author: devloop (devloop) Date: 2006-08-09 15:00
Hello !

In a code of mine if have the lines :
try:
  req = urllib2.Request(url)
  u = urllib2.urlopen(req)
  data=u.read()
except urllib2.URLError,err:
  // error handling here

The urllib2.URLError normally catchs the 
socket.timeout but someone send me a bug report of a 
tiemout error :

File "/usr/lib/python2.4/socket.py", line 285, in read
data = self._sock.recv(recv_size)
File "/usr/lib/python2.4/httplib.py", line 460, in read
return self._read_chunked(amt)
File "/usr/lib/python2.4/httplib.py", line 495, in
_read_chunked
line = self.fp.readline()
File "/usr/lib/python2.4/socket.py", line 325, in
readline
data = recv(1)
socket.timeout: timed out

Is it a bug with httplib and 'Content-Encoding: 
chunked' header ?
msg76748 - (view) Author: John J Lee (jjlee) Date: 2008-12-02 14:43
urlopen() raises URLError, .read() may raise other errors.  I don't
think that's a bug in itself, though no doubt:

 1. The documentation of exceptions raised could and should be improved
 2. The exceptions that can be raised are likely still inconsistent
(though this has improved in Python 2.6, I think)

Recommend closing this bug.

Please open other bugs about the issues above if you have patches.
msg81784 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-12 17:36
Should this one be closed and docs discussed in a new one? Volunteers? :)
msg81905 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-02-13 10:53
I agree.
History
Date User Action Args
2009-02-13 10:53:45georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg81905
2009-02-12 17:36:57ajaksu2setversions: + Python 2.6, - Python 2.4
nosy: + ajaksu2, georg.brandl, orsenthil
messages: + msg81784
assignee: georg.brandl
components: + Documentation, Library (Lib), - None
type: behavior
stage: test needed
2008-12-02 14:43:11jjleesetnosy: + jjlee
messages: + msg76748
2006-08-09 15:00:08devloopcreate