j105rob / pytesser

Automatically exported from code.google.com/p/pytesser
Other
0 stars 0 forks source link

calling image_to_string errs at subprocess.py #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
>>> from pytesser import *
>>> import Image
>>>im=Image.open('C:\\Python24\\Lib\\site-packages\\pytesser\\phototest.tif')
>>> text=image_to_string(im)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\site-packages\pytesser\pytesser.py", line 31, in
image_to_string
    call_tesseract(scratch_image_name, scratch_text_name_root)
  File "C:\Python24\lib\site-packages\pytesser\pytesser.py", line 21, in
call_tesseract
    proc = subprocess.Popen(args)
  File "C:\Python24\lib\subprocess.py", line 542, in __init__
    errread, errwrite)
  File "C:\Python24\lib\subprocess.py", line 706, in _execute_child
    startupinfo)
WindowsError: [Errno 2] The system cannot find the file specified
>>>

Original issue reported on code.google.com by anton.av...@gmail.com on 25 Jul 2007 at 6:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
In this version of PyTesser, the installation files must be in the same 
directory as
the script importing PyTesser.  Later versions will be more suitable for 
installing
in site-packages, or at least more explicit about usage limitations.  

Original comment by moke...@gmail.com on 6 Aug 2007 at 11:36

GoogleCodeExporter commented 8 years ago
I get this too. 

>>> from pytesser import *
>>> import Image
>>> im=Image.open('phototest.tif')
>>> text=image_to_string(im)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/shemtov/afik/pyt/pytesser.py", line 31, in image_to_string
    call_tesseract(scratch_image_name, scratch_text_name_root)
  File "/home/shemtov/afik/pyt/pytesser.py", line 21, in call_tesseract
    proc = subprocess.Popen(args)
  File "/usr/local/lib/python2.4/subprocess.py", line 542, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.4/subprocess.py", line 975, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

The installation files are in the same directory as the script i'm trying to, 
use,
and this should be even a moot point because I'm using the interpreter and it 
isn't
working. What am I missing?

Original comment by sildenaf...@gmail.com on 17 Jun 2008 at 6:27

GoogleCodeExporter commented 8 years ago
It looks like you're using *NIX.  PyTesser was developed for Windows--it might 
work
in *NIX if you substitute a native Tesseract executable, but you'll have to be
careful about filenames.

Original comment by mjtoke...@gmail.com on 18 Jun 2008 at 4:58

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
i have exactly the same problems does having windows 7 make a difference??

Original comment by daredevi...@gmail.com on 8 Mar 2010 at 11:01

GoogleCodeExporter commented 8 years ago
I'm on Windows 7 and having exactly the same problem. I have tried setting 
tesseract.exe to run in compatibility with earlier versions of Windows, and as 
administrator. 

Original comment by kn.mcgo...@gmail.com on 22 Mar 2010 at 11:15

GoogleCodeExporter commented 8 years ago
This is just horrible... how is this not working in Linux in Python? Have you 
never heard of os independant path's? hm...

Original comment by dro...@gmail.com on 23 Jul 2010 at 2:02

GoogleCodeExporter commented 8 years ago
works fine in linux as long as tesseract executable is in PATH :)
Tested on Ubuntu 10.04 and CentOS 5.4

Original comment by ben...@gmail.com on 7 Sep 2010 at 11:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Please help I get the same error with MAC OSx and python 2.6

 File "ex.py", line 3, in <module>
    print image_to_string(image)     # Run tesseract.exe on image
  File "/Users/gabrielcarneironovaes/Sites/python/pytesser/pytesser.py", line 31, in image_to_string
    call_tesseract(scratch_image_name, scratch_text_name_root)
  File "/Users/gabrielcarneironovaes/Sites/python/pytesser/pytesser.py", line 21, in call_tesseract
    proc = subprocess.Popen(args)
  File "/Applications/MAMP/python/framework/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/Applications/MAMP/python/framework/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Original comment by semprobl...@gmail.com on 20 Apr 2011 at 2:43

GoogleCodeExporter commented 8 years ago
i got the same error, im running on Ubuntu 11.04 with python 2.7

Traceback (most recent call last):
  File "test.py", line 15, in <module>
    pytesser.image_to_string(data)
  File "/home/jose/Documentos/Geek/pytesser.py", line 31, in image_to_string
    call_tesseract(scratch_image_name, scratch_text_name_root)
  File "/home/jose/Documentos/Geek/pytesser.py", line 21, in call_tesseract
    proc = subprocess.Popen(args)
  File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Original comment by jffiori...@gmail.com on 24 Aug 2011 at 9:45

GoogleCodeExporter commented 8 years ago
Another one of those "Doesn't work the way it's ****ing suppose to." A quick 
"I'll have this script ready in a few minutes" turned into a "My eyes are 
strained because I'v been staring at the damn screen for the past 3 hours 
trying to solve the same problem everybody else is experiencing above me"

It doesn't seem like anybody cared enough to guide us through a problem that's 
been going around since 2007 (it's 2011 now).... 

Original comment by thomas_5...@hotmail.com on 1 Oct 2011 at 6:25

GoogleCodeExporter commented 8 years ago
same problme here, windows7 32bit, Python2.6

Original comment by liny...@gmail.com on 28 Nov 2011 at 11:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
There's an easy work around for this if you're using the pytesser directory as 
a submodule (you've added an empty __init__.py file):

Change this line in pytesser.py (line 13):
    tesseract_exe_name = 'tesseract'

to this:
    tesseract_exe_name = os.path.dirname(__file__) + '/tesseract' 

That way it will look in the correct place for the executable.

Original comment by daniel.t...@gmail.com on 24 May 2012 at 10:00

GoogleCodeExporter commented 8 years ago
The program 'tesseract' is currently not installed.  You can install it by 
typing:

sudo apt-get install tesseract-ocr

Original comment by skipp...@gmail.com on 14 Mar 2013 at 5:32

GoogleCodeExporter commented 8 years ago
Email #17 by skipp...@gmail.com was the answer for me.

Original comment by Classica...@gmail.com on 20 Jun 2014 at 10:24

GoogleCodeExporter commented 8 years ago
I know why this happend:

because the python script use the command: tesseract, accutally like this:  
./tesseract  input-image
but you do not install "tesseract", so it told you : The system cannot find the 
file specified

details:

1. I's not the python script who "read" the words from the picture,  It's a 
command:  "tesseract"
2. why subprocess?  because, the python execute the cmd use multi-process,  the 
equal effect codes are like this: 
    os.system("tesseract  -input_pic,  -output_words ) , 

Original comment by qianyuha...@gmail.com on 8 Nov 2014 at 2:06

GoogleCodeExporter commented 8 years ago
For the next person who struggles with this, open pytesser.py and the first 
line that says:

    Import Image

Change this to 

    from PIL import Image

solved my issue.

Original comment by jadeo...@gmail.com on 27 Jun 2015 at 2:11