Error Handling
Hi,
I'm looking for a way to handle errors in Sikuli :
My goal is to check if a screenshot exists. If not, i'd like to :
- write a message in a custom error log
- close the app & stop the script
Did someone manage to script such a thing ?
Thanks,
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- nicolas
- Solved:
- 2010-02-02
- Last query:
- 2010-02-02
- Last reply:
- 2010-02-02
RaiMan (raimund-hocke) said : | #1 |
You have to mix in some Python: (mind indentation!!!)
switchApp(
check = find(... screenshot ...)
if not check: # if not there its none = false
makeEntryIn
closeApp(
else
click(check) # for example
pass # everything else goes here indented
look here https:/
I demonstrated reading a file.
nicolas (npawlaczyk) said : | #2 |
Thanks for the check, that works well for me.
Unfortunately, the closeApp does'nt stop the script :/
Is there anyway to kill the script execution ?
nicolas (npawlaczyk) said : | #3 |
I've found a way :
import sys #import Python sys module
sys.exit() #terminate the script
Worked well for me, hope this will help someone else :)