Tesseract

Asked by Jeff_Vallis

2.0.4-2020-03-14_08:01/Mac10.16/Java11(64)11.0.9+11

text - OCR capture was working and is now telling me its not installed
so what have I done since it last worked
1. Resinstalled Big Sure
2. Delete and reinstalled XCODE
3. Removed Java 13 which you told me I didn't need

what have I tried
1. Checked to see if tesseract is installed
tesseract -v
tesseract 4.1.1
 leptonica-1.80.0
  libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.1.0 : zlib 1.2.11 : libwebp 1.1.0 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found FMA
 Found SSE

it was so
brew install tesseract
this resulted in loads of
Updating Homebrew...
==> Auto-updated Homebrew!
....
....
result
Warning: tesseract 4.1.1 is already installed and up-to-date
To reinstall 4.1.1, run `brew reinstall tesseract`

% brew reinstall tesseract
==> Downloading https://homebrew.bintray.com/bottles/tesseract-4.1.1.big_sur.bottle.tar.gz
Already downloaded: /Users/Jeff/Library/Caches/Homebrew/downloads/29330e92fc356d70995c0bfcb61b1c30d8a9936ba6c7973339b1b1b4b4386ec0--tesseract-4.1.1.big_sur.bottle.tar.gz
==> Reinstalling tesseract
==> Pouring tesseract-4.1.1.big_sur.bottle.tar.gz
==> Caveats
This formula contains only the "eng", "osd", and "snum" language data files.
If you need any other supported languages, run `brew install tesseract-lang`.
==> Summary
🍺 /usr/local/Cellar/tesseract/4.1.1: 65 files, 29.7MB

So somewhere along the line its all gone wrong or
Do I need python 13 and not 11 which is the current

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- Resinstalled Big Sure
... but the system stamp says Mac10.16???

--- Java 11 or 13
the Java version does not really matter.
The recommendation for non-Java specialists simply is to stay with the LTS versions, which currently are 8 and 11.
Only Java 15 is currently problematic with SikuliX.

this might be helpful:
https://answers.launchpad.net/sikuli/+question/694243

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#2

May have changed since start of this item
Formated and reinstalled Big Sir version 11.1
2.0.4-2020-03-14_08:01/Mac10.16/Java8(64)1.8.0_271-b09

So from a clean install
Brew - Installed
jython
jruby
tesseract

ran IDE
Terminal
Last login: Tue Dec 22 16:34:19 on ttys000
jeff@Jeffs-iMac ~ % java -jar /Users/Jeff/Documents/SikuliX/sikulixide-2.0.4.jar

failed to load message missingjython and ruby
which were obviously on my machine bit not found by the IDE
used your link and installed the Jython from it
link :- https://github.com/RaiMan/SikuliX1/wiki/How-to-make-Jython-ready-in-the-IDE

exit from IDE gave the expected error message that I have reported before :-
Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
etc .....

ran IDE again - loaded
setRect to anything
v = text()
up came a webpage telling me to install tesseract
link :- https://github.com/RaiMan/SikuliX1/wiki/macOS-Linux:-Support-libraries-for-Tess4J-Tesseract-4-OCR
again I know its installed so ran the test suggested on the web page
tesseract -v
web page says result should be

and you should get something like this:
tesseract 4.1.0
 leptonica-1.78.0
  libgif 5.1.4 : libjpeg 9c : libpng 1.6.37 : libtiff 4.0.10 : zlib 1.2.11 : libwebp 1.0.3 : libopenjp2 2.3.1
...

I get :-
tesseract 4.1.1
 leptonica-1.80.0
  libgif 5.2.1 : libjpeg 9d : libpng 1.6.37 : libtiff 4.2.0 : zlib 1.2.11 : libwebp 1.1.0 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found FMA
 Found SSE

So I conclude that the IDE is not finding it maybe a link needs creating to the location of the Sikuli jar or a PATH needs adding

my stuff - env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/zsh
TERM=xterm-256color
TMPDIR=/var/folders/38/md8qlsg10pd0h5cppkrmvw5c0000gn/T/
TERM_PROGRAM_VERSION=440
TERM_SESSION_ID=9CE7DF99-EDBC-419F-9D4E-634442E38CD7
USER=jeff
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zi6APYxktM/Listeners
PATH=/Users/jeff/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
LaunchInstanceID=2386ABBF-DB5D-4E0B-89E9-FC14E4B20F9E
__CFBundleIdentifier=com.apple.Terminal
PWD=/Users/jeff
LANG=en_GB.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
PYENV_SHELL=zsh
SHLVL=2
HOME=/Users/jeff
LOGNAME=jeff
SECURITYSESSIONID=186a7
_=/usr/bin/env

Revision history for this message
RaiMan (raimund-hocke) said :
#3

what about the "might-be-helpful-link" in comment #1???

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#4

It would have done if I had read it properly

Tesseract now working ok

You have told me before that I need items at the top of my script does it matter what order they are in
I now have :-

# -*- coding: utf-8 -*-
import java.lang.System as JS
JS.setProperty("jna.library.path", "/usr/local/lib")
from sikuli import *

import Generator_Global
import datetime
import time
import os
import re
import os.path
from os import path

Thy reason I reformatted my Mac is :-
In Dec 2019 I got a new Mac and set it up from the Time Machine Backup of my previous Machine and of course getting 10 years of Rubbish
This time I did not dot that just loaded Big Sur and set it up again without all the Rubbish
It now seems to be running faster

My main problem for doing this was that Drag and Drop was not working and I felt that my Mac setup may be the cause
But it is still not working consistently.

It may or it may not try to do the drag drop

e.g.
the dragregion is found from an image on the screen

Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
        so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 956 449 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged

v_Wait (1second) is a seconds to wait between Drag and Drop
 I do Settings.MoveMouseDelay = v_Mouse_Delay (set at 3)
before trying the Drag and Drop

in the same run :
Drag_Drop_From_To dragregion 997 356 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
Drag_Drop_From_To dragregion 997 356 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
so it didn't move dragregion unchanged
Drag_Drop_From_To dragregion 1016 342 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       Partial move
       so it moved a bit dragregion instructed it to move to 1104 272 and it moved to 1016 342
Drag_Drop_From_To dragregion 1042 322 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       Partial move
       so it moved a bit dragregion instructed it to move to 1104 272 and it moved to 1042 322
Drag_Drop_From_To dragregion 1042 322 dropregion 1104 272 v_Wait,v_Mouse_Delay 1 3
       same again so it didn't move dragregion unchanged

I am still messing about with this
I fell sure that I have focus before the drag and and drop but am now looking for a safe image on screen that I can click just before doing the drag drop then I will play again with different waits and mouse speeds

If you have any suggestions I would be pleased to hear them

if not just mark this as solved as the tesseract problem no longer exists

Revision history for this message
RaiMan (raimund-hocke) said :
#5

--- does it matter what order they are in
the basic rule is:
import must be executed before the first use of related items from the imported stuff.

BTW:
# -*- coding: utf-8 -*- # done by from sikuli import *
import java.lang.System as JS
JS.setProperty("jna.library.path", "/usr/local/lib")
from sikuli import *

import Generator_Global
import datetime
import time # done by from sikuli import *
import os # done by from sikuli import *
import re
import os.path # done by from sikuli import *
from os import path # not needed, if you use os.path

--- drag drop problem
please start a new question.
best would be to have the script code to.
If possible create a short video of the situation.

You may send all stuff to me personally: sikulix---at---outlook---dot---com