Need help in OCR implementation with Python3.5.1 or pyCharm Community edition
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
On Thu, May 5, 2016 at 3:24 AM, Deepak Srivastava <d.srivastava15@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.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com
-- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/
On Thu, May 5, 2016 at 3:24 AM, Deepak Srivastava <d.srivastava15@gmail.com <mailto:d.srivastava15@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
On 2016-05-05 16:26, Ryan Gonzalez wrote: the problem. It's not clear where the file "Polish.png" is actually stored. It would be better to use a full file path.
On Thu, May 05, 2016 at 05:23:02PM +0100, MRAB wrote:
On 2016-05-05 16:26, Ryan Gonzalez wrote:
On Thu, May 5, 2016 at 3:24 AM, Deepak Srivastava
[ ... about three or four pages of quoting ... ]
Questions like this are better suited for python-list. [...] It looks to me that it's the url="Polish.png" [...]
Guys, it's bad enough that you're engaging in problem-solving mode for an off-topic question, but could you at least trim your replies first? There's no need to quote the entire body of the OP's post (three or four pages worth) only to add a two or three line comment to the end. Have pity on your readers and use the delete key on some of the unnecessary text, please? -- Steve
Well, the stack trace was pointing to the line that called Tesseract, so I figured that was the problem. -- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/ On May 5, 2016 11:24 AM, "MRAB" <python@mrabarnett.plus.com> wrote:
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.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe:
https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com
参加者 (4)
-
Deepak Srivastava
-
MRAB
-
Ryan Gonzalez
-
Steven D'Aprano