Re: xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'
> https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write > > The argument was added in Python 3.4. Presumably, lxml implemented the > API before this change. > > Maybe this would be considered a bug by lxml. Maybe it won't. Maybe it is not a bug, just a feature not implemented. After testing it a bit, I realized that for my chosen method (c14n) it cannot be specified anyway, because it must be False and actually it works that way. > > http://lxml.de/ links to a bug tracker and a mailing list. > All right, I'm subscribing to the list (I have other questions regarding C14N) -- https://mail.python.org/mailman/listinfo/python-list
Re: xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'
On 2017-09-22 14:29, Nagy László Zsolt wrote: > >> Result: >> >> Traceback (most recent call last): >> File "C:/not_telling/c14n.py", line 16, in >> short_empty_elements=False >> File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write >> (src\lxml\lxml.etree.c:57004) >> TypeError: write() got an unexpected keyword argument 'short_empty_elements' > Well, it looks like etree does not implement the short_empty_elements > argument in its write method: > > https://github.com/lxml/lxml/blob/master/src/lxml/etree.pyx#L1954 > > But it should (see > https://github.com/lxml/lxml/blob/master/src/lxml/etree.pyx#L5 - The > ``lxml.etree`` module implements the extended ElementTree API for XML. ) > > Can somebody please confirm that this is a bug? Also, how can I send a > bug report? ( I'm not able to add an issue to lxml, lack of permissions. ) > https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write The argument was added in Python 3.4. Presumably, lxml implemented the API before this change. Maybe this would be considered a bug by lxml. Maybe it won't. http://lxml.de/ links to a bug tracker and a mailing list. -- Thomas Jollans -- https://mail.python.org/mailman/listinfo/python-list
Re: xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'
> Result: > > Traceback (most recent call last): > File "C:/not_telling/c14n.py", line 16, in > short_empty_elements=False > File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write > (src\lxml\lxml.etree.c:57004) > TypeError: write() got an unexpected keyword argument 'short_empty_elements' Well, it looks like etree does not implement the short_empty_elements argument in its write method: https://github.com/lxml/lxml/blob/master/src/lxml/etree.pyx#L1954 But it should (see https://github.com/lxml/lxml/blob/master/src/lxml/etree.pyx#L5 - The ``lxml.etree`` module implements the extended ElementTree API for XML. ) Can somebody please confirm that this is a bug? Also, how can I send a bug report? ( I'm not able to add an issue to lxml, lack of permissions. ) -- https://mail.python.org/mailman/listinfo/python-list
xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'
Here is an MWE: import io from lxml import etree test_node = etree.fromstring(''' http://schemas.xmlsoap.org/soap/envelope/; xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512;> ''') output = io.BytesIO(b'') test_node.getroottree().write(output, encoding="UTF-8", xml_declaration=None, default_namespace=None, method="c14n", short_empty_elements=False ) output.seek(0) print(output.read()) Result: Traceback (most recent call last): File "C:/not_telling/c14n.py", line 16, in short_empty_elements=False File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write (src\lxml\lxml.etree.c:57004) TypeError: write() got an unexpected keyword argument 'short_empty_elements' I have tracked down this to: https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L721 This method does have a "short_empty_elements" argument, but if I set it to True, then it fails with TypeError. Is this a bug? -- https://mail.python.org/mailman/listinfo/python-list