[2.0.4] OCR Global settings not updated after setting Settings.OcrLanguages --- workaround

Asked by Daniel MASSACRIER

---------------------------- workaround

Settings.OcrLanguage= "fra"
OCR.reset() # take over Settings.OCR...
OCR.status()

------------------------------------------

I'm working with SIKULIX IDE 2.0.4 on Windows 7, and I would like to test OCR with french language.

I have the following code (OCR.py)

print "Before changing language:" + Settings.OcrLanguage
Settings.OcrLanguage= "fra"
print "After changing language :" + Settings.OcrLanguage
print OCR.status()
exit (1)

I run the program with SIKULIX IDE.
The result is

Before changing language:eng
After changing language:fra
None
Global settings OCR.Options:
data = null
language(eng) oem(3) psm(3) height(15,1) factor(1,99) dpi(96)
variables: user_defined_dpi:300
[info] Exit code: 1

and if I run a second time the same program with SIKULIX IDE, I have

Global settings OCR.Options:
data = null
language(fra) oem(3) psm(3) height(15,1) factor(1,99) dpi(96)
variables: user_defined_dpi:300
[info] Exit code: 1
Before changing language:eng
After changing language:fra
None

After the second run (and after all other runs), the language is correct (fra) in the OCR global settings.

I've got 2 questions:
- In the first run, why the language in OCR global settings does not change ?
- In the second run, why is there is mix in the order of the outputs ?

Thanks a lot for your answer.

Question information

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

---- - In the first run, why the language in OCR global settings does not change ?
I will check and come back

--- - In the second run, why is there is mix in the order of the outputs ?
This can always happen, if printout is coming from the script level (print ...) and from the Java level (OCR.status())

BTW: OCR.status() does not return anything (None), but itself creates printout at the Java level, hence use
OCR.status()
instead of
print OCR status()

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

see the workaround in the top post item.

I will optimise the behaviour in 2.0.5

Thanks for finding.

Can you help with this problem?

Provide an answer of your own, or ask Daniel MASSACRIER for more information if necessary.

To post a message you must log in.