openpaperwork / pyocr

A Python wrapper for Tesseract and Cuneiform -- Moved to Gnome's Gitlab
https://gitlab.gnome.org/World/OpenPaperwork/pyocr
931 stars 152 forks source link

Use `str()` instead of `.message` for exception #98

Closed danielquinn closed 6 years ago

danielquinn commented 6 years ago

In a case where a KeyError is raised, the exception is caught, but then it tried to reference ex.message, which doesn't exist for KeyErrors in modern versions of Python. Using str(ex) should deliver the same result.

jflesch commented 6 years ago

Thanks :)

jflesch commented 6 years ago

I have no release of PyOCR planned for a long time (not much changes currently). Do you need me to make a new release for this one ?

danielquinn commented 6 years ago

I've already patched Paperless to capture a KeyError, so there's no rush, but I'd rather not keep that check there if I don't have to as KeyErrors are rather generic and this would capture all cases of them. Anyway, if/when you do a release, please let me know so I can remove the check on my end.