← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #680188]: match() if not found what value does it give?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
>From where did you get the impression, that m.exists is the way to find out, wether the image was found before?
So please read the docs about the features and functions, before digging around.

BTW:
    m.highlight()
    wait (2)
    m.highlight()

is the same as 
m.highlight(2) # see docs

and if you use the highlight feature, you do not need any other feedback
like popups and prints.

The reason behind the trap into that you ran is very technical:
- the find op returns a Match object, which is the region the image occupies on the screen
- find throws FindFailed if not found (so your script should crash anyways if not found)
- m.exists is always True, because it is a function in the Match/Region class (so the else branch would never be executed anyways)

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