How to use the pytesseract.TesseractNotFoundError function in pytesseract

To help you get started, we’ve selected a few pytesseract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github madmaze / pytesseract / tests / test_pytesseract.py View on Github external
def test_proper_oserror_exception_handling(test_file, test_path):
    """"Test for bubbling up OSError exceptions."""
    import pytesseract
    pytesseract.pytesseract.tesseract_cmd = test_path
    with pytest.raises(
        TesseractNotFoundError if IS_PYTHON_2 and test_path else OSError
    ):
        pytesseract.pytesseract.image_to_string(test_file)
    pytesseract.pytesseract.tesseract_cmd = 'tesseract'  # restore the def value
github madmaze / pytesseract / tests / test_pytesseract.py View on Github external
def test_wrong_tesseract_cmd(test_file, test_path):
    """Test wrong or missing tesseract command."""
    import pytesseract
    pytesseract.pytesseract.tesseract_cmd = test_path
    with pytest.raises(TesseractNotFoundError):
        pytesseract.pytesseract.image_to_string(test_file)
    pytesseract.pytesseract.tesseract_cmd = 'tesseract'  # restore the def value