This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ConnectionError: ('Connection aborted.', BadStatusLine(""''''"))
Type: behavior Stage:
Components: Documentation Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: httplib: false BadStatusLine() raised
View: 8450
Assigned To: docs@python Nosy List: chrismattmann, docs@python, joecabrera, martin.panter, r.david.murray
Priority: normal Keywords:

Created on 2014-12-15 14:49 by joecabrera, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (9)
msg232664 - (view) Author: Joe Cabrera (joecabrera) Date: 2014-12-15 14:49
ConnectionError: ('Connection aborted.', BadStatusLine(""''''"))

This error can also occur on Linux and Windows, a more descriptive error messages would be useful for people trying to debug their code.
msg232666 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-15 15:06
I think you made a mistake in your copy and paste or retyping of that line, since it is not valid python syntax.

What is not explicit about it?  It is telling you there was a bad status line, and what the bad status line contents was.  (Used to be you couldn't tell, when the badness of the status line was that it was empty, that that was what the error message was saying, but I'm pretty sure we fixed that so that it shows an empty status line as an empty string in the message).
msg232667 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-15 15:08
Perhaps part of your problem is that you are not getting the string representation of the error message.  Is that because of your code, or is this representation something the stdlib is generating?
msg232758 - (view) Author: Joe Cabrera (joecabrera) Date: 2014-12-16 19:29
This is an error wrapping coming from requests.

The Requests team has concluded they can do nothing about this error, I believe the next step up is the python httplib library.
msg232761 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-16 20:11
I wonder the actual error reported in that issue has any relationship to issue 15082?

In any case, the error being presented to requests is *accurate*: httplib tried to read the status line and got nothing (the actual text in the linked issue is BadStatusLine("''")).  (Note that issue 7427 was where we fixed the repr, if you are curious).

I see that requests would like "a better error message".  Is there a concrete suggestion for what that better error message would look like?
msg232763 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-12-16 20:27
Not exactly sure what do you want the Python library to do, but perhaps this is a duplicate of Issue 8450, about making the error less misleading when the connection is closed before _any_ status line is sent. See also Issue 7427.
msg232766 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-16 22:29
Ouch.  I assumed the change was made to the repr, not the contents of line (I wasn't involved in that fix).  Not that that would actually affect this issue, I think, since Requests doesn't want to "introspect exception objects".
msg246921 - (view) Author: Chris Mattmann (chrismattmann) Date: 2015-07-18 23:16
Hi there, we are experiencing this in tika-python too, see:
msg246928 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-07-19 00:36
There is hopefully a better RemoteDisconnected exception and documentation in 3.5, thanks to Issue 3566. In Python 2, I think this is the same as Issue 8450.
Date User Action Args
2022-04-11 14:58:11adminsetgithub: 67243
2015-07-19 00:36:27martin.pantersetstatus: open -> closed
superseder: httplib: false BadStatusLine() raised
resolution: duplicate
messages: + msg246928
2015-07-18 23:16:00chrismattmannsetnosy: + chrismattmann
messages: + msg246921
2014-12-16 22:29:23r.david.murraysetmessages: + msg232766
2014-12-16 20:27:24martin.pantersetnosy: + martin.panter
messages: + msg232763
2014-12-16 20:11:17r.david.murraysetmessages: + msg232761
2014-12-16 19:29:53joecabrerasetmessages: + msg232758
2014-12-15 15:08:53r.david.murraysetmessages: + msg232667
2014-12-15 15:06:05r.david.murraysetnosy: + r.david.murray
messages: + msg232666
2014-12-15 14:49:03joecabreracreate