Want to pass a .py to Sikuli instead of a .sikuli dir to run --- solution

Asked by Shane Kalpage

********** solution
-- 1.
Set up the standalone packages as described in
https://answers.launchpad.net/sikuli/+faq/1436

-- 2.
you need at the beginning of each script:
from sikuli.Sikuli import *

-- 3.
run your script using
java -cp "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" org.python.util.jython Tests.py

-----------------------------------------------------------------------------------------------------------

When launching Sikuli using the command line such as
>java -jar "C:\Program Files (x86)\Sikuli\sikuli-script.jar" test.sikuli
is it possible to send it a test.py file instead of the test.sikuli dir?

We have a granular python unit test runner that allows us to cherry pick unit tests by creating a new temp ~test.py file in the same dir as the test.py file and running that file instead of the original file

However when we try to do this with Sikuli the IDE concatenates the name of the file to the path

'File not found - C: \\Tests.sikuli\\~Tests.py\\~Tests.py (The system cannot find the path specified)'

in the script file, setBundlePath() uses a relative path so we can't copy the file to a new directory without copying all the images across to the new dir and this can be time consuming.

Is there a way to switch off the concatenation ?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Shane Kalpage
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

No, that is not a feature.

you may try to run the jar internal jython instead, which accepts a .py:

java -cp "C:\Program Files (x86)\Sikuli\sikuli-script.jar" org.python.utils.jython test.sikuli

you need
from sikuli.sikuli import *

at the beginning of each script.

Check to use as additional Java parms:
-Xms64M -Xmx512M -Dfile.encoding=UTF-8

since these are the actual standards used by Sikuli IDE.

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

Sorry, dumb copy and paste :-(

should read:

java -cp "C:\Program Files (x86)\Sikuli\sikuli-script.jar" org.python.utils.jython test.py

Revision history for this message
Shane Kalpage (shane-snsys) said :
#3

Hi,
Thanks for your help; it works a treat :-D

However for the benefit of others I'll document a few small things I had to change.

You need to set up the standalone packages as described in https://answers.launchpad.net/sikuli/+faq/1436

And import sikuli.Sikuli import * (case sensitive)

The exact command line for version X should be

>java -cp "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" org.python.util.jython Tests.py

(in org.python.util.jython it should be util not untils)

Revision history for this message
RaiMan (raimund-hocke) said :
#4

ok, I could say, you passed the test and found all errors ;-)

but I do not - instead I apologize for the inconveniences you had because of MY typing errors.

I will move the correct version to the top. Thanks.