nekohayo / specto

Automatically exported from code.google.com/p/specto
0 stars 0 forks source link

parse urllib2's BadStatusLine error #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In some very rare occasions, the server (for a webpage) might close the
connection before you can read the status code. Should we cater for this
possible problem (it hangs specto) by cancelling the watch check and
continuing the refresh process?

Traceback (most recent call last):
  File "/home/jeff/trunks/specto/spectlib/watch_web_static.py", line 117,
in update
    response = urllib2.urlopen(request)
  File "/usr/lib/python2.5/urllib2.py", line 121, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.5/urllib2.py", line 374, in open
    response = self._open(req, data)
  File "/usr/lib/python2.5/urllib2.py", line 392, in _open
    '_open', req)
  File "/usr/lib/python2.5/urllib2.py", line 353, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.5/urllib2.py", line 1101, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.5/urllib2.py", line 1074, in do_open
    r = h.getresponse()
  File "/usr/lib/python2.5/httplib.py", line 924, in getresponse
    response.begin()
  File "/usr/lib/python2.5/httplib.py", line 385, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.5/httplib.py", line 349, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine

Original issue reported on code.google.com by nekoh...@gmail.com on 6 Mar 2007 at 4:32

GoogleCodeExporter commented 9 years ago
Here's a patch to catch that exception.  It should stop specto from crashing, 
at least.

Original comment by chalsero...@gmail.com on 27 Mar 2007 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in 0.2 r108.

Original comment by chalsero...@gmail.com on 21 Apr 2007 at 9:43

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 8 Mar 2008 at 11:17

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 18 Mar 2008 at 2:07

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 16 Apr 2011 at 2:54