How to disable Sikuli from Popping up error message on failure?

Asked by roi on 2016-12-08

Hi
I am new to Sikuli , When I execute the scripts from command line using the following command:
runIDE.cmd -r C:\SikuliX\Scipts\test.sikuli
Everything work ok and the scripts detects all elements.
when I want to test what happens when the script fails (for example closing the window which needs to be automated) , Sikuli obviously fails to find the element but it pops up window message error.
How can I change it to log the error without popping out the message?
Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
roi
Solved:
2016-12-12
Last query:
2016-12-12
Last reply:
2016-12-10

I thing you can build your custom function to decide what you want to do when script cann't find image.

Here is a piece of my code:
______
def try_click(our_image): # click-function with exception catched
        try:
                click(our_image)
        except FindFailed:
                pass
______

FindFailed is the exception generated when Sikuli doesn't find image. Instead of "pass" (placeholder instruction doing nothing) you can put there whatever you want, including logging to some file.

roi (azulay) said : #2

thanks , that helps