Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

[BUG] Replace deprecated getchildren method with list() #29

Description

@pkimp1

Description

For Python 3.9 and up, the getchildren() method is removed. See https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren

This will cause an error with message 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'.

Environment Information

  • Environment: Python 3.10

Stack Trace

'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

Sample Code Snippet

if element.tag == search_name:
    element_children = element.getchildren()
# instead use
if element.tag == search_name:
    element_children = list(element)

Suggested Fix

Replace all occurrences of this method (getchildren()) with list() as stated in the documentation linked above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions