[1.1.0+] HowTo use Region.observe()

Asked by spyros-liakos

 Hello. With sikulix 1.1.0 api i was success run this:

def handler(event):
    global count
    count = True
    wait(2)
    print("#Observe Error")
    clicktoavoiderrordone.click()
    event.stopObserver()
    regblueline.observe()
    return count

regblueline.onAppear(Pattern("error2.png").exact(),handler)
regblueline.onAppear(Pattern("error1.png").exact(),handler)
regblueline.observe(background = true)

#-------

But now when i use the sikulix1.1.1 the latest you got on the site (yesterday downloaded) api i get this error::

File "/Users/mintekrec/Library/Application Support/Sikulix/Lib/sikuli/Region.py", line 63, in observe
    return self.observe(waitTime);
RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)

Any hel please?????

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1
Revision history for this message
Alex Lunyov (lunyov-av) said :
#2

Yes, and it seems the title of that question is not proper. May be this is better: "Java region problem in observer (Sikuli 1.1.1)". "stopObserver" is not a subject.

Revision history for this message
RaiMan (raimund-hocke) said :
#3
Revision history for this message
Alex Lunyov (lunyov-av) said :
#4

@Raiman, the code example in onChanged part of the docs doesn't work in 1.1.1 and some previous nightly versions. It returns error "[error] TypeError ( observe(): takes no keyword arguments )". It was a problem to use observer in background (now solved with JRegion workaround).
Thanks for the renaming to make the questions clearer!

Revision history for this message
spyros-liakos (spy-arts) said :
#5

Hello again.. Now a new problem born... I left the script to play for about 7 hours and in 5th hour the observe stoped working...All the other moves work correctly but the observe stoped...

Why stoped working????

Can you help with this problem?

Provide an answer of your own, or ask spyros-liakos for more information if necessary.

To post a message you must log in.