← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #680301]: collectWords() raises java NPE

 

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

Mindaugas gave more information on the question:
I have another script that fails, different error, but similar issue:


Settings.OcrTextRead=True
Settings.OcrTextSearch=True

match = find("1555512374529.png")
wait(1)
print(match.getTarget().getX())
print(match.getTarget().getY())
print(match.getW())
print(match.getH())
words = Region(match.getX(), match.getY(), match.getW(), match.getH()).findAllText("Process")
print(words)


#print(match.getText()) # does not even highlight the method as available
# print(">>" + r.collectWords())
# print(">>" + collectWordsText())
) raised: Traceback (most recent call last):
  File "<string>", line 11, in <module>
        at org.sikuli.script.Region.doFindAll(Region.java:3063)
        at org.sikuli.script.Region.access$400(Region.java:23)
        at org.sikuli.script.Region$RepeatableFindAll.run(Region.java:3218)
        at org.sikuli.script.Region$Repeatable.repeat(Region.java:3126)
        at org.sikuli.script.Region.findAll(Region.java:2565)
        at org.sikuli.script.Region.findAllText(Region.java:2807)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NullPointerException: java.lang.NullPointerException


The fact that it fails on line: https://github.com/RaiMan/SikuliX1/blob/master/API/src/main/java/org/sikuli/script/Region.java#L3063

indicates that it did not find a match. Would lowering a matching
threshold help? How to deal with this situation in general? Should I
retry in a loop and with each iteration of the loop I should decrease
the match threshold?

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.