← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #202535]: Is there a command to end running script from within the script?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
There is an exit(number), but this simply ends the script and has no
feature, to restart it again automatically. If you run your script from
command line, you can start it again, if the exit number tells you to do
so (e.g. 1 signals, to stop and 0 says repeat) using a loop.

But I guess what you need is some loop in the script itself:

while True: #loops forever
    # some of your coding
    if some_condition:
         continue #start all over again at the while
    else:
         if some_other_condition: 
             break # jumps out of the while loop
   # more of your coding
# first statement after the loop

see faq 1437 on looping
and faq 1800 about indentation

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