Ошибка в python tesseract

Мне нужно с помощью python tesseract конвертировать номер на фото в текст

    import pytesseract
    from PIL import Image
    
    # img = Image.open('phone_number.png')
    # img = Image.open('eng_text.png')
    img = Image.open('number.png')
    pytesseract.pytesseract.tesseract_cmd = r'D:\python\venv\Scripts\pytesseract.exe'
    
    file_name = img.filename
    file_name = file_name.split(".")[0]
    
    # custom_config = r'--oem 3 --psm 13'
    custom_config = r'--oem 3 --psm 6'
    
    text = pytesseract.image_to_string(img, lang='rus', config=custom_config)
    print(text)
    
    with open(f'{file_name}.txt', 'w') as text_file:
        text_file.write(text)
    

После выполнение выдает ошибку

Traceback (most recent call last):
  File "D:\python\pybotavito\main.py", line 15, in <module>
    text = pytesseract.image_to_string(img, lang='rus', config=custom_config)
  File "D:\python\venv\lib\site-packages\pytesseract\pytesseract.py", line 413, in image_to_string
    return {
  File "D:\python\venv\lib\site-packages\pytesseract\pytesseract.py", line 416, in <lambda>
    Output.STRING: lambda: run_and_get_output(*args),
  File "D:\python\venv\lib\site-packages\pytesseract\pytesseract.py", line 284, in run_and_get_output
    run_tesseract(**kwargs)
  File "D:\python\venv\lib\site-packages\pytesseract\pytesseract.py", line 260, in run_tesseract
    raise TesseractError(proc.returncode, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (2, 'Usage: pytesseract [-l lang] input_file')

Process finished with exit code 1

Ответы (0 шт):