File 'tesseract.log' is Missing (Python 2.7, Windows)

I'm trying to write an OCR script with Python (2.7, Windows OS) to get text from images. First I've downloaded PyTesser and extracted it to Python27/Lib/site-packages as 'pytesser' and I've installed tesseract with pip install tesseract . Then I wrote the following script as self.py:

from PIL import Image
from pytesser.pytesser import *

image_file = 'C:/Users/blabla/test.png'
im = Image.open(image_file)
text = image_to_string(im)
text = image_file_to_string(image_file)
text = image_file_to_string(image_file, graceful_errors=True)
print text

But I'm getting the following error:

Traceback (most recent call last):
  File "C:/Users/blabla/self.py", line 7, in <module>
    text = image_file_to_string(image_file)
  File "C:Python27libsite-packagespytesserpytesser.py", line 44, in image_file_to_string
    call_tesseract(filename, scratch_text_name_root)
  File "C:Python27libsite-packagespytesserpytesser.py", line 24, in call_tesseract
    errors.check_for_errors()
  File "C:Python27libsite-packagespytessererrors.py", line 10, in check_for_errors
    inf = file(logfile)
IOError: [Errno 2] No such file or directory: 'tesseract.log'

And yes, there's no 'tesseract.log' file anywhere. What should I do? How should I solve this problem?

Thank you in advance.

Note: I've changed the line tesseract_exe_name from pytesser.py from tesseract to C:/Python27/Lib/site-packages/pytesser/tesseract but it doesn't work.

Edit: Alright, I've just runned teseract.exe that is in 'pytesser' and it created the 'tesseract.log' file but I'm still getting same error.


我已将def check_for_errors(logfile = "tesseract.log"):的行更改为def check_for_errors(logfile = "C:/Python27/Lib/site-packages/pytesser/tesseract.log"): in ../pytesser /errors.py ,它的工作。

链接地址: http://www.djcxy.com/p/96742.html

上一篇: 如何使用Tesseract和/或Poppler将PDF图像或图像转换为文本?

下一篇: 文件'tesseract.log'缺少(Python 2.7,Windows)