← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #161632]: True or False when image is visible

 

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

Calle Rundgren posted a new comment:
If I am using try: in order to check if images can be found or not.
def myFunc():
    try:
        find(image1)
    except:
        return FindFailed

If i have multiple images which shall be searched after eachother, is it
possible to put them all in an array in order to loop through it and
raise an exception if there is any?

Or if I do like this:

try:
    find(image1)
except:
    return FindFailed
try:
    find(image2)
except:
    return FindFailed
try:
    find(image3)
except:
    return FindFailed

Would i need to have this many try: to search for multiple images? Or is
this enough:

try:
    find(image1)
    find(image2)
    find(image3)
except:
    FindFailed

>From what I think this above operation would just raise one exception
when the first image is not found? What happens if there for instance is
two images which can not be found? Would two exceptions be raised or do
I have to use the code where one exception is raised per image not
found?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.