xml: TypeError: write() got an unexpected keyword argument 'short_empty_elements'

Thomas Jollans tjol at tjol.eu
Fri Sep 22 08:41:34 EDT 2017


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 <module>
>>     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



More information about the Python-list mailing list