sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #53483
[Bug 1272211] Re: [request] want an exit handler for running scripts, that is executed when the script terminates for whatever reason
** Changed in: sikuli
Importance: Low => Medium
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1272211
Title:
[request] want an exit handler for running scripts, that is executed
when the script terminates for whatever reason
Status in Sikuli:
In Progress
Bug description:
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1272211/+subscriptions
References