New question #194353 on Sikuli:
https://answers.launchpad.net/sikuli/+question/194353

I have set up an automation framework that launches Sikuli scripts on multiple 
remote virtual machines in parallel, then collects the results.

Since the scripts are the same, they somehow need to know that they  are 
running under different scenarios (use different login credentials, etc.).  I 
would like to be able to pass command line parameters to Sikuli scripts.

Right now, there's a runner (essentially a webserver) that receives requests 
over HTTP with script names, launches them, collects their console output, and 
returns that in an XML format for the mothership to process and analyze.

Here's the command that the runner uses to launch scripts:

java -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -jar 
"%SIKULI_HOME%\sikuli-script.jar" "[SCRIPT_DIR]\scriptName.sikuli"  2>&1

When I try to supply arguments to it using the --arg switch provided in the 
documentation, sikuli-script.jar seems to treat them as the names of sikuli 
scripts to run.   Here's an example.  The testArg.sikuli script simply prints 
out the content of sys.argv:

===============
File: testArg.sikuli
===============

import sys

print "I will print all values in argv\n"

for a in sys.argv:
    print a
===============

Then I launch it with this command:

java -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -jar 
"%SIKULI_HOME%\sikuli-script.jar"--arg firstargument testArgv.sikuli"  2>&1

This is the console output I get:

===============
[error] Can't run this Sikuli script: --arg
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source)
        at org.sikuli.script.ScriptRunner.getPyFrom(ScriptRunner.java:106)
        at org.sikuli.script.ScriptRunner.runPython(ScriptRunner.java:100)
        at org.sikuli.script.SikuliScript.main(SikuliScript.java:111)
[error] Can't run this Sikuli script: firstargument
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source)
        at org.sikuli.script.ScriptRunner.getPyFrom(ScriptRunner.java:106)
        at org.sikuli.script.ScriptRunner.runPython(ScriptRunner.java:100)
        at org.sikuli.script.SikuliScript.main(SikuliScript.java:111)
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
I will print all values in argv

.       estArgv.sikuli
--arg
firstargument
.\testArgv.sikuli
===============

It seems like the testArgv.sikuli script does get a hold of command line 
parameters in sys.argv, but the jar archive still treats them as sikuli script 
names.

Any ideas on how to tackle this?  Thanks!

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to