Image_to_string not working on Mac

I am trying to follow this pytesser example ( link ) in Mac Maverick.

>>> from pytesser import * >>> im = Image.open('phototest.tif') >>> text = image_to_string(im) 

But on the last line, I get this error message:

 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pytesser.py", line 31, in image_to_string call_tesseract(scratch_image_name, scratch_text_name_root) File "pytesser.py", line 21, in call_tesseract proc = subprocess.Popen(args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 

But I do not understand what I should do. The phototest file is in the same folder in which I run the script. How to fix it?

UPDATE:

When i try

 brew install tesseract 

I get this error:

 Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Error: You must `brew link libtiff libpng jpeg' before tesseract can be installed 
+6
source share
1 answer

I actually had the same error as yours, here's how I found this post. I also have a solution to my problem because you gave it to me!

I have seen:

 ryan.davis$ python tesseract.py Traceback (most recent call last): File "tesseract.py", line 52, in <module> print (image_to_string(big)) File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string config=config) File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract stderr=subprocess.PIPE) File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 

Want to know what I had to do to fix this? What you tried: brew install tesseract I installed the python tesseract library but did not install it at the system level. So that solves my problem. How about yours?

I think you could be distracted by this:

A warning. Do you have MacPorts or Fink. Software installed with other package managers causes known problems for Homebrew. If the formula fails to build, uninstall MacPorts / Fink and try again.

And didn’t notice that your answer was already presented in the brew answer:

You must brew link libtiff libpng jpeg before tesseract can be installed.

So:

 brew link libtiff brew link libpng brew link jpeg 

Then:

 brew install tesseract 

Finally:

 :) 
+8
source

All Articles