相关文章推荐

Python 3.9: AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

Hello. In Fedora, we are already trying to build all packages with Python 3.9.0a2. gobject-introspection fails:

Traceback (most recent call last):
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/tools/g-ir-scanner", line 100, in <module>
    sys.exit(scanner_main(sys.argv))
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/scannermain.py", line 615, in scanner_main
    write_output(data, options)
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/scannermain.py", line 469, in write_output
    passthrough_gir(main_f_name, temp_f)
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/scannermain.py", line 260, in passthrough_gir
    parser.parse(path)
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/girparser.py", line 60, in parse
    self.parse_tree(tree)
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/girparser.py", line 69, in parse_tree
    self._parse_api(tree.getroot())
  File "/builddir/build/BUILD/gobject-introspection-1.62.0/x86_64-redhat-linux-gnu/giscanner/girparser.py", line 106, in _parse_api
    for node in root.getchildren():
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

Indeed, getchildren() was deprecated since Python 3.2: Use "for node in root" instead.

Original Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1788092

 
推荐文章