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

decodebytes() Depreciated in hocr-pdf use decodestring() #170

Open
UBISOFT-1 opened this issue Dec 12, 2021 · 4 comments
Open

decodebytes() Depreciated in hocr-pdf use decodestring() #170

UBISOFT-1 opened this issue Dec 12, 2021 · 4 comments

Comments

@UBISOFT-1
Copy link

/home/muneeb/.local/bin/hocr-pdf:134: DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()
  uncompressed = bytearray(zlib.decompress(base64.decodestring(font)))

In the file we need to go ahead and use decodestring() function instead.

@UBISOFT-1
Copy link
Author

Also what will happen if we go ahead and change the encoding from 'latin-1' to 'utf-8' would that help if we are dealing with lets say Arabic Typescript.

@kba
Copy link
Contributor

kba commented Dec 13, 2021

/home/muneeb/.local/bin/hocr-pdf:134: DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()
  uncompressed = bytearray(zlib.decompress(base64.decodestring(font)))

In the file we need to go ahead and use decodestring() function instead.

True, cf. #169

Also what will happen if we go ahead and change the encoding from 'latin-1' to 'utf-8' would that help if we are dealing with lets say Arabic Typescript.

Possibly, I have never used hocr-pdf with non-latin texts - what happens when you do? Let's discuss separately in #171.

@FriedrichFroebel
Copy link

This apparently already has been fixed, but not yet released: d756f75

@jrochkind
Copy link

Is this maybe the same problem that has turned into an outright error instead of deprecation now?

I am not very familiar with python, just trying out hocr-pdf, and I get this error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/hocr-pdf", line 143, in <module>
    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'

If this is the same thing, and has been fixed but not yet released... any plans for a release?

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

No branches or pull requests

4 participants