Author djc
Recipients djc
Date 2009-12-03.15:52:41
SpamBayes Score 3.31196e-12
Marked as misclassified No
Message-id <>
For whatever reason, BadStatusLine tracebacks often don't show the line
passed into them. Given the errr, heavy architecture of httplib, this
makes it pretty bad to debug. It's not clear to me why this is:

Traceback (most recent call last):
  File "/home/djc/src/couchdb-python/couchdb/tests/", line 138,
in test_attachment_crud_with_files
    doc = self.db['foo']
  File "/home/djc/src/couchdb-python/couchdb/", line 293, in
    _, _, data = self.resource.get(id)
  File "/home/djc/src/couchdb-python/couchdb/", line 333, in get
    return self._request('GET', path, headers=headers, **params)
  File "/home/djc/src/couchdb-python/couchdb/", line 350, in _request
  File "/home/djc/src/couchdb-python/couchdb/", line 179, in request
    resp = _try_request()
  File "/home/djc/src/couchdb-python/couchdb/", line 167, in
    return conn.getresponse()
  File "/usr/lib/python2.6/", line 950, in getresponse
  File "/usr/lib/python2.6/", line 390, in begin
  File "/usr/lib/python2.6/", line 354, in _read_status

However, some interactive testing shows that this should work:

djc@enrai couchdb-python $ python
Python 2.6.2 (r262:71600, Oct  5 2009, 12:18:48)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class CrapShoot(Exception):
...     def __init__(self, a):
...             self.args = a,
>>> raise CrapShoot('a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
__main__.CrapShoot: a
>>> class ParentExc(Exception):
...     pass
>>> class CrapShoot(ParentExc):
...     def __init__(self, a):
...             self.args = a,
>>> raise CrapShoot('a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
__main__.CrapShoot: a

Definition of BadStatusLine:

class BadStatusLine(HTTPException):
    def __init__(self, line):
        self.args = line,
        self.line = line

class HTTPException(Exception):
    # Subclasses that define an __init__ must call Exception.__init__
    # or define self.args.  Otherwise, str() will fail.

The note here seems like a cautionary but insufficient tale...
Date User Action Args
2009-12-03 15:52:44djcsetrecipients: + djc
2009-12-03 15:52:44djcsetmessageid: <>
2009-12-03 15:52:42djclinkissue7427 messages
2009-12-03 15:52:41djccreate