← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #165384]: JRuby: Java NullPointerException if imagefile not found

 

Question #165384 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/165384

    Status: Open => Answered

RaiMan proposed the following answer:
The internal workflow with a string as first parameter to any find operation currently is:
--1- check, wether it is an existing image file
--2- if yes: normal visual find operation
--3- if not a valid image file, try to find the given text (switch to text search via tesseract)

And this seems to be the problem here (only the significant messages):

[info] Mac OS X utilities loaded.
[info] Sikuli vision engine loaded.
[debug] File not found: some text, assume it's text.
[info] Text Recognizer inited.
java.lang.NullPointerException
	at java.io.Reader.<init>(Reader.java:61)
	at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
	at org.sikuli.script.ResourceExtractor.writeFileList(ResourceExtractor.java:28)
	at org.sikuli.script.ResourceExtractor.extract(ResourceExtractor.java:22)
	at org.sikuli.script.TextRecognizer.init(TextRecognizer.java:41)
....... some more tracebacks
Unable to load unicharset file tessdatatessdata/eng.unicharset

So it seems, that the text recognizer init makes the problem in a JRuby environment (finding text does not work at all).
This is some kind of bug. I will have a look at it and come back. 

*** If you try the same in the Sikuli IDE (which uses Jython), you get the defined behavior:
--- exists("not-exisiting.png")
will simply return None (as it should)

--- find("not-exisiting.png")
will produce a FindFailed exception, which can be catched

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.