[docs] (take 2) Python 3.1.2 xml.sax doc error, or bug, or error by the operator...

Éric Araujo merwok at netwok.org
Thu Nov 25 12:33:52 CET 2010


Hi,

> Traceback (most recent call last):
>   File " xmlsad.py", line 10, in <module>
>     xml.sax.parseString("hello", m)
>   File "C:\Python31\lib\xml\sax\__init__.py", line 45, in parseString
>     inpsrc.setByteStream(BytesIO(string))
> TypeError: 'str' does not support the buffer interface

The TypeError may come from setByteStream or BytesIO.  Look at the docs
for the latter: http://docs.python.org/dev/library/io#io.BytesIO
Bingo, it accepts only bytes, not characters, so you have to pass a
bytes object, not a str.

Regards



More information about the docs mailing list