Pegerto Fernández schrieb am 03.10.2014 um 12:44:
I try to use lxml to perform a c14n over a document
c14ndoc = io.StringIO() tree.write_c14n(c14ndoc)
I am having this issue:
File "lxml.etree.pyx", line 2271, in lxml.etree._ElementTree.write_c14n (src\lxml\lxml.etree.c:60874) File "serializer.pxi", line 592, in lxml.etree._tofilelikeC14N (src\lxml\lxml.etree.c:124249) File "lxml.etree.pyx", line 316, in lxml.etree._ExceptionContext._raise_if_stored (src\lxml\lxml.etree.c:10291) File "serializer.pxi", line 407, in lxml.etree._FilelikeWriter.write (src\lxml\lxml.etree.c:121770) TypeError: string argument expected, got 'bytes'
Do you have any idea ?
Sure. You are trying to write byte data to a text stream. Use io.BytesIO() instead.