viewing paste chatgpt 4o error | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
---------------------------------------------------------------------------
TesseractError                            Traceback (most recent call last)
Cell In[1], line 19
     16 sharpened_img = gray_img.filter(ImageFilter.SHARPEN)
     18 # OCR processing
---> 19 text = pytesseract.image_to_string(sharpened_img, lang='kor')
     21 text
 
File ~/.local/lib/python3.11/site-packages/pytesseract/pytesseract.py:413, in image_to_string(image, lang, config, nice, output_type, timeout)
    408 """
    409 Returns the result of a Tesseract OCR run on the provided image to string
    410 """
    411 args = [image, 'txt', lang, config, nice, timeout]
--> 413 return {
    414     Output.BYTES: lambda: run_and_get_output(*(args + [True])),
    415     Output.DICT: lambda: {'text': run_and_get_output(*args)},
    416     Output.STRING: lambda: run_and_get_output(*args),
    417 }[output_type]()
 
File ~/.local/lib/python3.11/site-packages/pytesseract/pytesseract.py:416, in image_to_string.<locals>.<lambda>()
    408 """
    409 Returns the result of a Tesseract OCR run on the provided image to string
    410 """
    411 args = [image, 'txt', lang, config, nice, timeout]
    413 return {
    414     Output.BYTES: lambda: run_and_get_output(*(args + [True])),
    415     Output.DICT: lambda: {'text': run_and_get_output(*args)},
--> 416     Output.STRING: lambda: run_and_get_output(*args),
    417 }[output_type]()
 
File ~/.local/lib/python3.11/site-packages/pytesseract/pytesseract.py:284, in run_and_get_output(image, extension, lang, config, nice, timeout, return_bytes)
    273 with save(image) as (temp_name, input_filename):
    274     kwargs = {
    275         'input_filename': input_filename,
    276         'output_filename_base': temp_name,
   (...)
    281         'timeout': timeout,
    282     }
--> 284     run_tesseract(**kwargs)
    285     filename = kwargs['output_filename_base'] + extsep + extension
    286     with open(filename, 'rb') as output_file:
 
File ~/.local/lib/python3.11/site-packages/pytesseract/pytesseract.py:260, in run_tesseract(input_filename, output_filename_base, extension, lang, config, nice, timeout)
    258 with timeout_manager(proc, timeout) as error_string:
    259     if proc.returncode:
--> 260         raise TesseractError(proc.returncode, get_errors(error_string))
 
TesseractError: (1, 'Error opening data file /usr/share/tesseract-ocr/5/tessdata/kor.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'kor\' Tesseract couldn\'t load any languages! Could not initialize tesseract.')
Viewed 692 times, submitted by Streusel.