← Back to team overview

sikuli-driver team mailing list archive

[Question #676840]: Inconsistent behaviour of SIkuli code run

 

New question #676840 on Sikuli:
https://answers.launchpad.net/sikuli/+question/676840

I am getting inconsistent results when i  try running the following code. 



Basically what happens is observe_and_click(..) method is called, which will cause the region to observe for changes. Once region detects changes, the handler method will be called. 

def observe_and_click(self,phone_region, pixel_region, handler, observe_time):
        pixel_region.click() # make pixel click on region
        print("after click")
        phone_region.observe(observe_time)   # how long to observe for

 def handler(self,event):
        global i
        r = event.getRegion() # get the observing region for this event
        wait(0.5)
        found = False 
        for j in range(i):
            print("j: " + str(j))
            try:
                match = r.find(base_path + str(j))
                found = True
                break
            except FindFailed:
                print("ignore")
        print(found)
        if (found == False):
            print("whY")
            path = capture(r,"/Users/ongyichong/SikuliX/Scripts",str(i))
            i += 1
            print(str(i))

Problem is sometimes when i go into the handler code, the print(found) does not get executed. I expect the handler code to get executed completely when it detects a change. At other times, i am able to see the print(found) on my terminal. Not sure why I am getting inconsistency in results ? 

I could post more details about the debug logs if needed. 

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