[Python-Dev] Need help in OCR implementation with Python3.5.1 or pyCharm Community edition

MRAB python at mrabarnett.plus.com
Thu May 5 12:23:02 EDT 2016


On 2016-05-05 16:26, Ryan Gonzalez wrote:
> On Thu, May 5, 2016 at 3:24 AM, Deepak Srivastava 
> <d.srivastava15 at gmail.com <mailto:d.srivastava15 at gmail.com>> wrote:
>
>
>>     Dear All,
>>
>>     I am new to python and very much excited to learn this technology.
>>
>>     I have done setup of python 3.5.1 with PyCharm community edition
>>     on windows 7(64bit service pack 1).
>>
>>     I am trying to execute some piece of code but it fails .
>>     Requesting you to please help.
>>
>>     My Piece of code is
>>
>>     /import /pytesseract
>>     /from /PIL /import /Image
>>     /from /PIL /import /ImageFilter
>>     /import /os
>>     print (os.getcwd())
>>     url=*"Polish.png"
>>     */def /process_image(/url/):
>>     image = _get_image(/url/)
>>         image = image.filter(ImageFilter.SHARPEN)
>>     #    image = image.convert('1')
>>     print (pytesseract.image_to_string(image))
>>
>>     /def /_get_image(/url/):
>>     /return /Image.open(/url/)
>>
>>     process_image(url)
>>
>>     Error which I am getting ,
>>
>>     *C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\python.exe
>>     C:/Temp/Opt/src/ocr.py*
>>
>>     *C:\Temp\Opt\src*
>>
>>     *in subprocess*
>>
>>     *None*
>>
>>     *0*
>>
>>     *None*
>>
>>     *None*
>>
>>     *<subprocess.STARTUPINFO object at 0x02EA4BF0>*
>>
>>     *Traceback (most recent call last):*
>>
>>     *  File "C:/Temp/Opt/src/ocr.py", line 17, in <module>*
>>
>>     *process_image(url)*
>>
>>     *  File "C:/Temp/Opt/src/ocr.py", line 12, in process_image*
>>
>>     *    print (pytesseract.image_to_string(image))*
>>
>>     *  File
>>     "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\pytesseract\pytesseract.py",
>>     line 161, in image_to_string*
>>
>>     *config=config)*
>>
>>     *  File
>>     "C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\pytesseract\pytesseract.py",
>>     line 94, in run_tesseract*
>>
>>     *stderr=subprocess.PIPE)*
>>
>>     *  File
>>     "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py",
>>     line 950, in __init__*
>>
>>     *restore_signals, start_new_session)*
>>
>>     *  File
>>     "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py",
>>     line 1226, in _execute_child*
>>
>>     *    startupinfo)*
>>
>>     *FileNotFoundError: [WinError 2] The system cannot find the file
>>     specified*
>>
>>     **
>>
>>     *Process finished with exit code 1*
>>
>>     Thanks and Regards
>>
>>     Deepak Srivastava
>>
>
> Questions like this are better suited for python-list. Regardless, you 
> need to install Tesseract first:
>
> https://github.com/tesseract-ocr/tesseract/wiki
>
> That should fix the error.
It looks to me that it's the url="Polish.png" that's the real cause of 
the problem. It's not clear where the file "Polish.png" is actually 
stored. It would be better to use a full file path.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160505/e78f32ee/attachment.html>


More information about the Python-Dev mailing list