sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #09921
Re: [Question #193835]: exit() always returns '1' on Sikuli
Question #193835 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/193835
Status: Open => Answered
RaiMan proposed the following answer:
The normal way, to handle exceptions, is to catch only those exceptions,
that might happen, because you did not script any preventive actions for
that. If your code is "good" it will not produce any exceptions.
an example:
#saying:
click(some_image)
#will raise a "FindFailed" exception, if the image is not found and your
script will end with an error.
#You can handle this in two ways:
try: click(some_image)
except FindFailed: print "some_image not found"; exit(1)
#or
if exists(some_image): click(getLastMatch())
else: print "some_image not found"; exit(1)
Or you can use one of the FindFailed interactive handling options.
So looking at your code, I do not see the need to catch any other
exception than FindFailed.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.