← Back to team overview

sikuli-driver team mailing list archive

[Question #195343]: Trapping error for Region.wait ?

 

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

code:

    if NextEpisodeRegion.wait("logo.png",8):

If the logo is not found, the following exception is presented:

Exception in thread "Thread-4"   Line 61, in file test.py

        at org.sikuli.script.Region.handleFindFailed(Region.java:420)
        at org.sikuli.script.Region.wait(Region.java:511)
        at org.python.proxies.sikuli.Region$Region$0.super__wait(Unknown Source)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)

org.sikuli.script.FindFailed: FindFailed: can not find logo.png on the screen.
  Line 61, in file test.py

This kind of gets in the way of my error output...I am wondering if there is a more graceful way to deal with this exception?  I tried

findLogo =  NextEpisodeRegion.wait("logo.png",8):
if findLogo.....

but I seem to get the same.  I need to allow up to 8 seconds from the time a hotkey is triggered to see if the logo appears and if not then exit the def gracefully.  Would i need to do a find instead?  How would I delay this...if that's the answer, does it affect me in any other way (synchronous/async, etc...).

thanks!

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