pyfpdf
pyfpdf copied to clipboard
Workaround
AttributeError: 'HTML2FPDF' object has no attribute 'unescape'
+1
HTMLParser.unescape is deprecated since Python 3.4, and was removed from 3.9:
https://github.com/pypa/setuptools/commit/53b8db359378f436bfd88f90a90aaf01b650d3a6
fpdf2 uses
import html
html.unescape(text)
as seen below:
https://github.com/PyFPDF/fpdf2/blob/aa86a0f28ad1955b78a01381635cac5c11c20d82/fpdf/html.py#L9
https://github.com/PyFPDF/fpdf2/blob/aa86a0f28ad1955b78a01381635cac5c11c20d82/fpdf/html.py#L522
see #171