sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #23591
Re: [Question #242642]: Custom error handling in Sikuli
Question #242642 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/242642
Description changed to:
Hey, I've been trying to find out how to do this for a while.
I have a program which is step-based.
I want to be able to execute some code if and when my Sikuli script
stops running. And it needs to be for ANY reason (invalid image
found/user stops the program (shift+alt+c)/user quits the program when
being prompted) except for reasons like invalid Python code.
Basically what I need to do if and when the program quits due to either
user input or an error is I need to open up a file and write a step
number to it. It's just the error handling that I'm a bit stumped about.
Some exploration has led me to believe that I'd need to do something
with a try... except... statement. But I don't know how exactly to go
about it.
Any help is appreciated. Thanks in advance.
P.S. There is a workaround I can easily use, which is to write the
number of the step to the file as the user begins the step, but I feel
that it's inefficient and bad practice to do it every single step rather
than when it really needs to be done. But if there is no better way to
do it then I'll have to fallback on that.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.