pythonexceptionsikulisikuli-scriptsikuli-x

Sikuli - How to turn off FindFailed exceptions, setThrowException() not working


I'm using Sikulix IDE v2.0.5 and trying to search on the screen a specific word, then look at his right if there is another specific word.

I saw that I should use setThrowException(False) to Skip the FindFailed Exception, but when implementing it I still get them thrown.

enter image description here

enter image description here

[error] FindFailed ( 1642158588596.png: (74x10) seen at (443, 190) with 1,00 in R[517,190 300x10]@S(0) )
[error] --- Traceback --- error source first
line: module ( function ) statement 
6: main (  <module> )     if link.right(300).find("1642158588596.png"):
[error] --- Traceback --- end --------------

Solution

  • Looks like SCREEN.setThrowException(False) wasn't taken into account after using Region's right() function.

    For it to work I needed to set the exception on the new Region returned by right():

    for word in words:
        word = word.right(300)
        word.setThrowException(False)
    ...