Issue on Region .text

Asked by Sikulipro

I get this error
Region.text: text recognition is currently switched off

please let me know why this error occurs

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
obiwan-92 (obiwan-92) said :
#1

Hello,

Like notified in the install instructions, the OCR is by default switch off.
So if you want to use it, you have to install it and allow it in the settings of Sikuli.

Regards.

Revision history for this message
Eugene S (shragovich) said :
#2

Try to include the following command before trying to read text:

Settings.OcrTextRead = True

Revision history for this message
Sikulipro (saindane-harshal) said :
#3

1) How to download and install Ocr, is any link or setup

2) i am using Settings.OcrTextRead = True this but getting below error

[error] TextRecognizer: init: tessdata folder not found at D:/Users/1484/Downloads/libs/

Revision history for this message
Sikulipro (saindane-harshal) said :
#4

now i have checked allow searching for text and allow OCR,

now i am getting an error as:-

[error] TextRecognizer: init: tessdata folder not found at
[error] Region.text: text recognition is now switched off
--- no text ---

Revision history for this message
obiwan-92 (obiwan-92) said :
#5

Hello,

Normally, you have an option during the install of Sikuli.

For the other problem, look at :
https://answers.launchpad.net/sikuli/+faq/2436

Regards.

Revision history for this message
obiwan-92 (obiwan-92) said :
#6

Be aware, the OCR have some problem in the 1.0.1 version of Sikuli.

If it's not worked, the two best workaround are :
- to compare text like it was image with exists or find methods.
- to use your clipboard with the command :
type('c', Key.Modifier.CTRL)
text = Env.getClipboard

Regards.

Revision history for this message
Sikulipro (saindane-harshal) said :
#7

Hi,

I am really thankful to your support,

please check the attachment,i have an issue.

________________________________
 From: obiwan-92 <email address hidden>
To: <email address hidden>
Sent: Wednesday, 5 February 2014 10:01 PM
Subject: Re: [Question #243322]: Issue on Region .text

Your question #243322 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243322

obiwan-92 proposed the following answer:
Be aware, the OCR have some problem in the 1.0.1 version of Sikuli.

If it's not worked, the two best workaround are :
- to compare text like it was image with exists or find methods.
- to use your clipboard with the command :
type('c', Key.Modifier.CTRL)
text = Env.getClipboard

Regards.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/sikuli/+question/243322/+confirm?answer_id=5

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/sikuli/+question/243322

You received this question notification because you asked the question.

Revision history for this message
Sikulipro (saindane-harshal) said :
#8

Hi,

with using this i am getting

type('c', Key.Modifier.CTRL)
text = Env.getClipboard

[error] AttributeError ( type object 'org.sikuli.script.Key' has no attribute 'Modifier' )

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

These are really basics and can easily be solved by simply looking into the docs: http://doc.sikuli.org

type('c', KeyModifier.CTRL)

Revision history for this message
obiwan-92 (obiwan-92) said :
#10

@Sikulipro
Sorry, again I didn't take my coffee and again I made a mistake.
See the comment #9 to have the correct code.

@RaiMan
Like always, thanks a lot (and continue to take your coffee ;-)).

Regards everyone.

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

@ Obiwan
Uuups, did not realize, that this was your suggestion. I know, that YOU know the docs. so do not feel addressed ;-)
Nevertheless, even experts like us are making mistakes, so it is the responsibility of the consumer of our suggestions to try to understand and eventually find out what's wrong with it.
Anyway, thanks for your contribution.
Really appreciated.

Revision history for this message
obiwan-92 (obiwan-92) said :
#12

@RaiMan
Don't worry. Actually I still read the documentation, sometimes.
Thanks for calling me an expert, even if I'm not sure I am. ;-)

@Sikulipro
Key is a class who containing all the key of a qwerty keyboard (Key.NUM1, Key.ESC, Key.SHIFT, Key.ENTER, ....)
KeyModifier use the Java code mask to simulate a double action (KeyModifier.SHIFT, KeyModifier.ALT, ...).
For example : type('c', KeyModifier.CTRL) -> do Ctrl + c (the copy shortcut, just like you do :-) )

Best regards.

Revision history for this message
Veronika (norika1111) said :
#13

Hi, I did what said here: https://answers.launchpad.net/sikuli/+faq/2436 :
- deleted the libs folder mentioned in the error message
- Turned on 'allow OCR' option in settings
- Use line Settings.OcrTextRead = True
- Restarted Sikuli IDE
 And still can't get text:

text = regFileItem.text()

those my errors:
[error] TextRecognizer: init: tessdata folder not found at /Applications/SikuliX-IDE.app/Contents/libs/
[error] Region.text: text recognition is now switched off

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

@Veronika
- did you run setup besides option 1 with option 5 (want to use Tesseract)?
if not, repeat setup accordingly.

- if you did, after setup having deleted the libs folder, restart the IDE from command line with option -d 3 -c.
The log should show somewhere in the middle, that the tessdata folder is exported (check in the folder)

- restart the IDE.

If you only run scripts from inside the IDE, setting the options in more preferences is enough.

If you want to run scripts from command line too, you should use at the beginning of your main script:
Settings.OcrTextRead = True

Revision history for this message
Veronika (norika1111) said :
#15

Reinstalling IDE with option 5 (want to use Tesseract) helped. Thanks.

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

@Veronika
… glad I could help. Could things always be such easy ;-)