← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #264927]: Another '__exit__' problem

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
The problem is the usage of the with: statement.

with iTunes.window().findAll("Entfernen.png") as theButtons:
    Debug.user("Found: ", theButtons.next())

this should work:

theButtons = iTunesRegion.findAll("Entfernen.png")
while theButtons.hasNext():
    Debug.user("Found: ", theButtons.next())

The usage of the with statement is only implemented for Region objects.
Since most SikuliX objects are not "real" Python/Jython objects, but Java objects, the with feature is not available for them and leads to weird errors.
I always recommend to not use it at all with any Sikuli objects.

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