Open ghost opened 2 years ago
base64.decodestring
has been removed in Python 3.9, it has been deprecated since 3.1 - can you run with a less recent Python version?
Thank you! I installed python 3.8.12 with pyenv and now it works perfectly... and so fast!
While using an older Python version might have been the solution, this does not seem to hold true any more, with recent Ubuntu versions shipping Python 3.10 by default and Python 3.11 being available. Adding a corresponding check should be easy enough while retaining compatibility with Python 2 (although this is broken for now: https://github.com/ocropus/hocr-tools/issues/158#issuecomment-1353653532).
There is no need to support any Python version before 3.7 (which is the oldest version which is still officially supported). And you are right, the code should be fixed to work with recent Python versions, too.
This apparently already has been fixed in 2019, but not yet released: https://github.com/ocropus/hocr-tools/commit/d756f75ce8cf1224a78c9eab5db4952be17b9d70
Hello!
I've install hocr-tools on both mac and ubuntu and get the same error. All images are jpg and the hocr files were created by tesseract.
I'm wondering if I have the wrong versions of supporting libraries installed.
Traceback (most recent call last): File "/opt/homebrew/bin/hocr-pdf", line 143, in
export_pdf(args.imgdir, 300)
File "/opt/homebrew/bin/hocr-pdf", line 51, in export_pdf
load_invisible_font()
File "/opt/homebrew/bin/hocr-pdf", line 134, in load_invisible_font
uncompressed = bytearray(zlib.decompress(base64.decodestring(font)))
AttributeError: module 'base64' has no attribute 'decodestring'
Name: hocr-tools Version: 1.1.1 Name: lxml Version: 4.6.4 Name: Pillow Version: 8.4.0 Name: reportlab Version: 3.6.2