RootTheBox icon indicating copy to clipboard operation
RootTheBox copied to clipboard

XML Parsing Issue (Python 3.9)

Open anthturner opened this issue 5 years ago • 2 comments

[E 201015 17:16:25 xmlsetup:322] Exception raised while parsing /tmp/juiceshop.xml, rolling back changes
    Traceback (most recent call last):
      File "/opt/rtb/setup/xmlsetup.py", line 309, in _xml_file_import
        levels = get_child_by_tag(xml_root, "gamelevels")
      File "/opt/rtb/setup/xmlsetup.py", line 44, in get_child_by_tag
        tags = [child for child in elem.getchildren() if child.tag == tag_name]
    AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

I think this might be related to Python 3.9 dropping support for xml.etree.ElementTree.Element.getchildren. I suspect that since the docker container calls for "python:3", upstream maintainers have incremented the default version for the "3" tag to be a version of python which no longer supports this method.

https://docs.python.org/3/whatsnew/3.9.html

Methods getchildren() and getiterator() of classes ElementTree and Element in the ElementTree module have been removed. They were deprecated in Python 3.2. Use iter(x) or list(x) instead of x.getchildren() and x.iter() or list(x.iter()) instead of x.getiterator(). (Contributed by Serhiy Storchaka in bpo-36543.)

Also may be related to #410

anthturner avatar Oct 15 '20 17:10 anthturner

Changing https://github.com/moloch--/RootTheBox/blob/master/Dockerfile#L6 to python:3.8 fixes this for the moment.

anthturner avatar Oct 15 '20 18:10 anthturner

Thanks for the report @anthturner I'll make that change and I'll try to work on a version that works for both 3.8 and 3.9. Hate when they do stuff like that... I mean, is it really a big deal for them to leave the shortcut for backward compatibility within minor version changes. Save the removal for 4.x.

eljeffeg avatar Oct 15 '20 19:10 eljeffeg