← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #202942]: exit() inside try/except

 

Question #202942 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/202942

RaiMan proposed the following answer:
@Roman ;-)
import sys 
not needed in Sikuli scripts, since sys and time are already imported

The problem with Sikuli's exit() in a try, is that it itself throws some
exception deep inside (which is still a bug of course;-)

The advantage of using exit() is, that it internally processes some
(minor) script finalizing, which helps to avoid some oddities that might
happen in the IDE.

So if you want to use exit():

shouldExit = false
try:
   regVig.find(Pattern("Ocarreramexc.png").similar(0.50).targetOffset(-2,43))
   pressKEY(1,Key.ENTER)
   popup("Ocorreram exceções neste cálculo!".decode('utf-8'))
   shouldExit = true
except:
   wait(8)
   calcular()
if shouldExit: exit()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.