Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling image_to_string errs at subprocess.py #2

Open
GoogleCodeExporter opened this issue Mar 21, 2016 · 20 comments
Open

calling image_to_string errs at subprocess.py #2

GoogleCodeExporter opened this issue Mar 21, 2016 · 20 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 25 Jul 2007 at 6:18

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 6 Aug 2007 at 11:36

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 17 Jun 2008 at 6:27

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 18 Jun 2008 at 4:58

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

i have exactly the same problems does having windows 7 make a difference??

Original comment by [email protected] on 8 Mar 2010 at 11:01

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 22 Mar 2010 at 11:15

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 23 Jul 2010 at 2:02

@GoogleCodeExporter
Copy link
Author

works fine in linux as long as tesseract executable is in PATH :)
Tested on Ubuntu 10.04 and CentOS 5.4

Original comment by [email protected] on 7 Sep 2010 at 11:32

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 20 Apr 2011 at 2:43

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 24 Aug 2011 at 9:45

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 1 Oct 2011 at 6:25

@GoogleCodeExporter
Copy link
Author

same problme here, windows7 32bit, Python2.6

Original comment by [email protected] on 28 Nov 2011 at 11:31

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 24 May 2012 at 10:00

@GoogleCodeExporter
Copy link
Author

The program 'tesseract' is currently not installed.  You can install it by 
typing:

sudo apt-get install tesseract-ocr

Original comment by [email protected] on 14 Mar 2013 at 5:32

@GoogleCodeExporter
Copy link
Author

Email #17 by [email protected] was the answer for me.

Original comment by [email protected] on 20 Jun 2014 at 10:24

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 8 Nov 2014 at 2:06

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 27 Jun 2015 at 2:11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant