← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #691302]: [HowTo] handling findFailed

 

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

Description changed to:
Hello there ...

am using Sikuli for pretty basics task, am not a developer so will be
great if any of you give me a hand to solve my issue.

So let me explain what am trying to do ...

I have 2 images, if any of them are at the region, then do something
"except crashing :( "

I found how to handle it with "exists()" but the problem is that the two
images are very very simular with other images so, sometimes it does
well, sometimes not, the best is using .. find() but it stop the entire
script if does not find anything.

my code is like this...

myRegion = Region(1186,447,173,63)

if myRegion.find(image1.png) or myRegion.find(image2.png):
      print("Found")
else:
     print("not found") 

continue with the script .....


I tried to handle it with this...
try:
      myRegion = Region(1186,447,173,63)

      if myRegion.find(image1.png) or myRegion.find(image2.png):
           print("Found")
      else:
          print("not found")
except findFailed:
      pass

But it cotinues crashing....

I know that Sikuli is well documented but i couldnt understand how fix
it, so ...

could someone please give me an example how to handle findFailed without stop my script?
I know that i can use all these but i dont know how... "setFindFailedResponse(SKIP), setThrowException(False), a function to handle it, etc."


Note: am using python, Sikuli IDE on Linux Mint 19.03

Thanks, regards!

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