← Back to team overview

sikuli-driver team mailing list archive

[Question #229988]: How to implement Try Catch error handling in Sikuli Script

 

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

Hello,
 When I try to implement the try catch functionality in my script.
Let me explain the scenario first.

I have a file with data
The script goes through each row of the data and dynamically populates data in the software from row 1 and than once it completes the operation it moves to row 2 and continues with the next row of data.

I implemented try catch functionality that should work as follows
try:
   somefunction(passed)
except Exception:
  return(failed)

than the script does a clean up


Basically when I try to implement try, catch functionality and an unexpected issues comes up, I still end up getting internal sikuli errors of image not found, so instead of function returning a failure and continuing on with doing a clean up and moving on to the next row, it fails out in the ide with image not found error.


[error] Stopped
[error] An error occurs at line 117
[error] Error message: Traceback (most recent call last):
 File "C:\DOCUME~1\xxxx\LOCALS~1\Temp\sikuli-tmp8064744401480455439.py", line 117, in 
 status = CC_FindFA()
 File "C:\DOCUME~1\xxxx\LOCALS~1\Temp\sikuli-tmp8064744401480455439.py", line 69, in CC_FindFA
 wait(Pattern("gSaveInterac-1.png").similar(0.32))
 File "C:\Documents and Settings\xxxx\My Documents\Sikuli X\sikuli-script.jar\Lib\sikuli\Region.py", line 99, in wait
 Line 87, in file C:\DOCUME~1\xxxxx\LOCALS~1\Temp\sikuli-tmp8064744401480455439.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.GeneratedMethodAccessor53.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 Pattern("gSaveInterac-1.png").similar(0.32) on the screen.
 Line 87, in file C:\DOCUME~1\xxxx\LOCALS~1\Temp\sikuli-tmp8064744401480455439.py

So my question is, is it possible to do a try an catch error handling with sikuli, and if so how can be implemented?

Thank you.
P.T.

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