[New-bugs-announce] [issue1148] TypeError on join - httplib mixing str and bytes

Eduardo Padoan report at bugs.python.org
Tue Sep 11 19:26:25 CEST 2007

New submission from Eduardo Padoan:

To reproduce:

>>> import httplib
>>> conn = httplib.HTTPConnection("www.python.org")
>>> conn.request("GET", "/index.html")
>>> r1 = conn.getresponse()
>>> r1.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/eopadoan/pub/py3k/Lib/httplib.py", line 540, in read
    s = self._safe_read(self.length)
  File "/home/eopadoan/pub/py3k/Lib/httplib.py", line 627, in _safe_read
    return "".join(s)
TypeError: sequence item 0: expected string or Unicode, bytes found

Also, shouldn't the message  be like "...expected str, bytes found"?

components: Library (Lib)
messages: 55827
nosy: eopadoan
severity: normal
status: open
title: TypeError on join - httplib mixing str and bytes
type: crash
versions: Python 3.0

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list