Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extract_text_from_image(filename):
try:
text = image_to_string(Image.open(filename), lang=LANGUAGE)
except TesseractError as e:
text = "\nCheck Tesseract OCR Configuration\n"
text += e.message
return text