[xml] libxml2 SAX python interface: Bug with Python3
- From: René Neumann <necoro necoro eu>
- To: xml gnome org
- Subject: [xml] libxml2 SAX python interface: Bug with Python3
- Date: Fri, 30 Aug 2013 23:02:47 -0000
Dear all,
when using the libxml2 interface via xml.sax in Python3, I get an
exception concerning str vs bytes. Please see the following minimal example:
Python 3.2.5 (default, Aug 26 2013, 21:33:16)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import xml.sax
from io import BytesIO
saxparser = xml.sax.make_parser(["drv_libxml2"])
source = xml.sax.xmlreader.InputSource()
source.setByteStream(BytesIO(b'<rss></rss>'))
saxparser.parse(source)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.2/site-packages/drv_libxml2.py", line 223, in
parse
eltName = _d(reader.Name())
File "/usr/lib64/python3.2/site-packages/drv_libxml2.py", line 70, in _d
return _decoder(s)[0]
File "/usr/lib64/python3.2/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
TypeError: 'str' does not support the buffer interface
A quick look reveals, that all(?) the reader.…()-calls already return an
encoded string and hence this _d() is moot. But I don't know which side
needs to be fixed.
Regards,
René
P.S.: Please put me on CC on replies, I'm not subscribed.
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]