jacklicn / tesseract-ocr

Automatically exported from code.google.com/p/tesseract-ocr
Other
0 stars 0 forks source link

Program keeps printing same line over and over clogging up prompt #579

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Using PyTesser as a wrapper in Python:
###
import Image, ImageGrab
from tesseract import image_to_string
while 1:
    output = image_to_string(ImageGrab.grab(cords))
    #use output here

What is the expected output? What do you see instead?

Expected the output is nothing; I do not wish to have any output - I do however 
get the line "Tesseract Open Source OCR Engine v3.01 with Leptonica" over and 
over again.

What version of the product are you using? On what operating system?
v3.01 on Windows 7 32bit

Please provide any additional information below.
It is not PyTesseract, as the line prints when PyTesseract calls

subprocess.Popen('tesseract', ...), the path to Tesseract being in my path. 

... and I never had this issue on v3.0

Original issue reported on code.google.com by Zedlakit...@hotmail.com on 20 Nov 2011 at 2:44

GoogleCodeExporter commented 9 years ago
I swapped around on "expected" and "the" under expected output, it seems.

Original comment by Zedlakit...@hotmail.com on 20 Nov 2011 at 2:48

GoogleCodeExporter commented 9 years ago
PyTesser is not part of tesseract-ocr, so you should rise issue at pytesser...
Or provide example where tesseract-ocr executable provide this behaviour...

Original comment by zde...@gmail.com on 20 Nov 2011 at 6:47

GoogleCodeExporter commented 9 years ago
PyTesser is not the issue, as I said in the main post - It happens when 
PyTesser opens a subprocess with the command prompt with "tesseract", the path 
to tesseract-ocr being in my PATH variable. 

I just went to the folder with tesseract.exe (That is tesseract-ocr), and did 
tesseract.exe image.tif output, and the same line "Tesseract Open Source ..." 
appeared. 

So the issue is with tesseract-OCR, and not with PyTesser, as stated in the 
original post.

Original comment by Zedlakit...@hotmail.com on 20 Nov 2011 at 5:06

GoogleCodeExporter commented 9 years ago
if issue is in tesseract-ocr that provide example with tesseract-ocr only (no 
wrapper) ;-). Good luck. 

Original comment by zde...@gmail.com on 20 Nov 2011 at 5:56

GoogleCodeExporter commented 9 years ago
I already provided an example with tesseract-ocr only. Are you reacding my 
posts? 

"I just went to the folder with tesseract.exe (That is tesseract-ocr), and did 
tesseract.exe image.tif output, and the same line "Tesseract Open Source ..." 
appeared. "

Original comment by Zedlakit...@hotmail.com on 20 Nov 2011 at 6:15

GoogleCodeExporter commented 9 years ago
I solved the issue by adding stdout=subprocess.PIPE as an argument to 
subprocess.Popen() in the wrapper, so it ended up like proc = 
subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) It 
does not print any output now and just returns the OCR result as a string. 

Original comment by Zedlakit...@hotmail.com on 21 Nov 2011 at 9:54

GoogleCodeExporter commented 9 years ago
Issue 580 has been merged into this issue.

Original comment by zde...@gmail.com on 22 Nov 2011 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by zde...@gmail.com on 22 Nov 2011 at 7:57

GoogleCodeExporter commented 9 years ago
If I specify "2>&1 1> /dev/null" on linux I still see: "Tesseract Open Source 
OCR Engine". That is definitely not what I want. 

Original comment by guido.va...@gmail.com on 19 Feb 2012 at 10:06

GoogleCodeExporter commented 9 years ago
in 3.02 you can use "quiet" option e.g: tesseract phototest.tif phototest quiet

@guido.vansteen: "2>&1 1> /dev/null" do not work with any command on linux. Try:
 ls non_existing_folder 2>&1 1>/dev/null
Correct way is "1>/dev/null 2>&1". The order is important.

Original comment by zde...@gmail.com on 28 Oct 2012 at 7:07