【发布时间】:2017-01-11 21:52:20
【问题描述】:
这是我第一次使用 pytesseract。我正在尝试对小图像执行简单的 OCR。代码归结为:
from PIL import Image
from pytesseract import image_to_string
test = Image.open(r'C:\test.jpg')
print(image_to_string(test))
这会抛出 OSError: [WinError 6] The handle is invalid
Traceback (most recent call last):
File "C:\Testing.py", line 5, in <module>
print(image_to_string(test))
File "C:\\pytesseract.py", line 161, in image_to_string
config=config)
File "C:\\pytesseract.py", line 94, in run_tesseract
stderr=subprocess.PIPE)
File "C:\\subprocess.py", line 911, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\\subprocess.py", line 1150, in _get_handles
c2pwrite = self._make_inheritable(c2pwrite)
File "C:\\subprocess.py", line 1182, in _make_inheritable
_winapi.DUPLICATE_SAME_ACCESS)
OSError: [WinError 6] The handle is invalid
我在 Windows 7 上使用 Python 3.5。
提前感谢您的宝贵时间!
【问题讨论】:
标签: python python-3.x subprocess python-tesseract