Gracefully Quit Sikuli Script?

Asked by Stefani

How can I gracefully quit a Sikuli script so that it does not invoke the exception handler? If I get into a a certain situation, there is no point in continuing. How can I tell it to exit?

I've tried:
type("c", KEY_ALT | KEY_SHIFT) -> produces an exception.
exit() -> Gives name error
sys.exit() -> produces exception SystemError
os._exit() -> This kills the whole thing including Sikuli. This goes too far.

When I try these things and run from the IDE, I always get the red line highliting this point in execution with exception / error messages printed in the output. I just want to fully exit the script, quietly.

Is this possible?

Thanks,
Stef

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Tsung-Hsiang Chang
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Very good question. Since you seem to have some experience with python, I can limit my despair: did not find any possibility, so I get used to just use "raise 'I am fed up'", when I want to stop the script ;-)

But thats not really graceful.

My suggestion: turn this question into a bug, since I think, it's a missing feature.

Revision history for this message
Best Tsung-Hsiang Chang (vgod) said :
#2

Well, Raiman is right. It's a missing feature. I will add an exit() function in 0.10.

Revision history for this message
Stefani (stefani-home) said :
#3

Okay. Sad to see it's not there, but glad to see I'm not crazy. And, will be happy to see it come to v0.10. Thanks!

If I don't see it already, I will go ahead and write up the bug report (feature request) to make sure it doesn't fall thru the cracks.

-Stef