Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py 3.9 failures: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' #583

Closed
QuLogic opened this issue Jun 22, 2020 · 2 comments

Comments

@QuLogic
Copy link
Contributor

QuLogic commented Jun 22, 2020

When running on Python 3.9, tests fail with the above error.

Traceback (most recent call last):
  File "/usr/lib64/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/builddir/build/BUILDROOT/ocrmypdf-10.1.0-1.fc33.x86_64/usr/lib/python3.9/site-packages/ocrmypdf/_sync.py", line 214, in exec_page_sync
    ocr_out = render_hocr_page(hocr_out, page_context)
  File "/builddir/build/BUILDROOT/ocrmypdf-10.1.0-1.fc33.x86_64/usr/lib/python3.9/site-packages/ocrmypdf/_pipeline.py", line 612, in render_hocr_page
    hocrtransform.to_pdf(
  File "/builddir/build/BUILDROOT/ocrmypdf-10.1.0-1.fc33.x86_64/usr/lib/python3.9/site-packages/ocrmypdf/hocrtransform.py", line 191, in to_pdf
    elemtxt = self._get_element_text(elem).rstrip()
  File "/builddir/build/BUILDROOT/ocrmypdf-10.1.0-1.fc33.x86_64/usr/lib/python3.9/site-packages/ocrmypdf/hocrtransform.py", line 112, in _get_element_text
    for child in element.getchildren():
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

There are about 15 failures, but I think they all end in this same traceback.

To Reproduce

pytest -ra -n auto

Here is a build log for 9.8.2, but it also fails locally for me with 10.1.0.

System

  • OS: Fedora Rawhide
  • OCRmyPDF Version: 9.8.2/10.1.0
  • How did you install ocrmypdf? Not installed; building a package.
@QuLogic
Copy link
Contributor Author

QuLogic commented Jun 22, 2020

Note, this method was deprecated since 3.2, though only warned in 3.8: https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren

@jbarlow83
Copy link
Collaborator

Thanks - fixed in v10.2.0 along with other issues in that module.

samtux added a commit to GeoTux2/Asistente-LADM-COL that referenced this issue Aug 19, 2021
Update the version etree:

ocrmypdf/OCRmyPDF#583
samtux added a commit to GeoTux2/Asistente-LADM-COL that referenced this issue Aug 19, 2021
Update version 3.9 etree module:

ocrmypdf/OCRmyPDF#583
samtux added a commit to GeoTux2/Asistente-LADM-COL that referenced this issue Aug 19, 2021
gacarrillor pushed a commit to SwissTierrasColombia/Asistente-LADM-COL that referenced this issue Aug 19, 2021
gacarrillor pushed a commit to SwissTierrasColombia/Asistente-LADM-COL that referenced this issue Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@QuLogic @jbarlow83 and others