Skip to content

Incompatibilities with Python 3.9a6: Element.getiterator is gone #953

@arcivanov

Description

@arcivanov

https://docs.python.org/3.9/whatsnew/3.9.html#removed

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(). The xml.etree.cElementTree module has been removed, use the xml.etree.ElementTree module instead. Since Python 3.3 the xml.etree.cElementTree module has been deprecated, the xml.etree.ElementTree module uses a fast implementation whenever available. (Contributed by Serhiy Storchaka in bpo-36543.)

File "/tmp/pip-install-3ukgfx0p/markdown/setup.py", line 167, in run
        out = template % self._get_context(src, outfile)
File "/tmp/pip-install-3ukgfx0p/markdown/setup.py", line 106, in _get_context
        c['body'] = self.md.convert(src)
File "build/lib/markdown/__init__.py", line 295, in convert
        newRoot = treeprocessor.run(root)
File "build/lib/markdown/treeprocessors.py", line 350, in run
        brs = root.getiterator('br')
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

Found in pybuilder/pybuilder#722 while testing 3.9 compatibility as a transitive dependency of Sphinx:

BUILD FAILED - Unable to install plugin packages into /home/travis/build/pybuilder/pybuilder/.pybuilder/plugins/cpython-3.9.0.alpha.6. Please see '/home/travis/build/pybuilder/pybuilder/.pybuilder/plugins/cpython-3.9.0.alpha.6/install.log' for full details:
	        self.distribution.run_command(command)
	      File "/home/travis/.pyenv/versions/3.9.0a6/lib/python3.9/distutils/dist.py", line 985, in run_command
	        cmd_obj.run()
	      File "/home/travis/.pyenv/versions/3.9.0a6/lib/python3.9/distutils/command/build.py", line 135, in run
	        self.run_command(cmd_name)
	      File "/home/travis/.pyenv/versions/3.9.0a6/lib/python3.9/distutils/cmd.py", line 313, in run_command
	        self.distribution.run_command(command)
	      File "/home/travis/.pyenv/versions/3.9.0a6/lib/python3.9/distutils/dist.py", line 985, in run_command
	        cmd_obj.run()
	      File "/tmp/pip-install-3ukgfx0p/markdown/setup.py", line 167, in run
	        out = template % self._get_context(src, outfile)
	      File "/tmp/pip-install-3ukgfx0p/markdown/setup.py", line 106, in _get_context
	        c['body'] = self.md.convert(src)
	      File "build/lib/markdown/__init__.py", line 295, in convert
	        newRoot = treeprocessor.run(root)
	      File "build/lib/markdown/treeprocessors.py", line 350, in run
	        brs = root.getiterator('br')
	    AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'
	    ----------------------------------------
	ERROR: Command errored out with exit status 1: /home/travis/build/pybuilder/pybuilder/.pybuilder/plugins/cpython-3.9.0.alpha.6/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3ukgfx0p/markdown/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3ukgfx0p/markdown/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-a7b0kr8g/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/build/pybuilder/pybuilder/.pybuilder/plugins/cpython-3.9.0.alpha.6/include/site/python3.9/markdown Check the logs for full command output. (pybuilder/install_utils.py:97)

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidInvalid report (user error, upstream issue, etc).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions