New submission from djc <dirk...@ochtman.nl>: 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/client.py", line 138, in test_attachment_crud_with_files doc = self.db['foo'] File "/home/djc/src/couchdb-python/couchdb/client.py", line 293, in __getitem__ _, _, data = self.resource.get(id) File "/home/djc/src/couchdb-python/couchdb/http.py", line 333, in get return self._request('GET', path, headers=headers, **params) File "/home/djc/src/couchdb-python/couchdb/http.py", line 350, in _request credentials=self.credentials) File "/home/djc/src/couchdb-python/couchdb/http.py", line 179, in request resp = _try_request() File "/home/djc/src/couchdb-python/couchdb/http.py", line 167, in _try_request return conn.getresponse() File "/usr/lib/python2.6/httplib.py", line 950, in getresponse File "/usr/lib/python2.6/httplib.py", line 390, in begin File "/usr/lib/python2.6/httplib.py", line 354, in _read_status BadStatusLine However, some interactive testing shows that this should work: d...@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. pass The note here seems like a cautionary but insufficient tale... ---------- components: Library (Lib) messages: 95934 nosy: djc severity: normal status: open title: BadStatusLine is hell to debug versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7427> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com