[request] want an exit handler for running scripts, that is executed when the script terminates for whatever reason

Bug #1272211 reported by RaiMan
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

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.

RaiMan (raimund-hocke)
summary: - [request] want an exit handler for running scripts, that is executed if
- the script terminates for whatever reason
+ [request] want an exit handler for running scripts, that is executed
+ when the script terminates for whatever reason
Changed in sikuli:
status: New → In Progress
importance: Undecided → Low
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
milestone: 1.1.0 → 1.2.0
Revision history for this message
obiwan-92 (obiwan-92) wrote :

Hello,

Python like Java works with exception.

try:
    # Your code
except :
    # Your action where there is some problem.

Regards

RaiMan (raimund-hocke)
Changed in sikuli:
milestone: 2.0.0 → 2.1.0
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Low → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.