When running a batch of 5 Sikuli scripts from the main.sikuli script, how do I get the remaining scripts to continue running if one of the scripts fail?

Asked by tomanderson

Hi,

I have a question that others may run into or have already run into.

I have 5 sikuli scripts that need to be run one after another.
Each of the 5 scripts has "from sikuli import *" in the first line.
I have a main.sikuli script that imports each of the five sikuli scripts like this:

import test1
import test2
import test3
import test4
import test5

When I run the main.sikuli script from the SikulixIDE 1.1.0 editor, every thing works fine and all 5 scripts will run one after the other.

Now if one of them fails for some reason, the remaining scripts will not run and the editor shows the error. How do I get all the scripts to run even if one of the scripts in the beginning fail. Is there something (keyword) I can insert between each import statement that will force run the next script and keep the log of the initial failure.

Thanks so much for your help. I am new to Sikuli and it is great!!
Keep up the good work!

Tom

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
tomanderson
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

To use RobotFramework is one of the way to solve the problem.
http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-robotframework

Revision history for this message
RaiMan (raimund-hocke) said :
#2
Revision history for this message
tomanderson (tomanderson) said :
#3

Hi RaiMan,

Thank you for your guidance. I have upgraded to SikuliX 1.1.1 and looked at the link you suggested. I have tried a few things but I am not quite sure how to make it work. For my particular instance, my test1, test2,... scripts are fairly straight forward and simple only containing click(), wait(), and find().

Could you give me specific details as to what I need to have in my test scripts.
For example in the main.sikuli should I use "runSript(C:\SikuliX\test1, *parameter)" instead of "import test1"? And I'm not sure what to put in for the *parameter.
Does the test1.sikuli script still need "from sikuli import *" in the first line if I am using the runScript command.
Is this supposed to be run in the editor or command line?

Thanks again for your help and guidance,

Tom

Revision history for this message
masuo (masuo-ohara) said :
#4

I tried the following sample codes, and it worked.

-----------sample01.sikuli------------
# -*- coding:utf-8
from sikuli import *

def main():
    find("image01.png").highlight(2)
main()

-----------sample02.sikuli------------
# -*- coding:utf-8
from sikuli import *

def main():
    find("image02.png").highlight(2)
main()

-----------sample03.sikuli------------
runScript("C:\script\sample01.sikuli")
runScript("C:\script\sample02.sikuli")

Revision history for this message
tomanderson (tomanderson) said :
#5

Thank you very Masuo. This has solved my problems.
Keep up the good work!

Tom