Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Commit

Permalink
Use str() instead of .message for exception
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danielquinn authored Apr 28, 2018
1 parent ecb07b5 commit 23405f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pyocr/tesseract.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def detect_orientation(image, lang=None):
}
except Exception as ex:
raise TesseractError(-1, "No script found in image (%s - %s)"
% (ex.message, original_output))
% (str(ex), original_output))


def get_name():
Expand Down

0 comments on commit 23405f7

Please sign in to comment.