Can not find command line tool version of Sikuli; To Run sikuli script from Python.

Asked by Anshu

HI All,
I am a newbie to Sikuli and so far find it quite impressive.

I was going through post : https://answers.launchpad.net/sikuli/+question/100436 - where it mentions to install the command line version of Sikuli , but i can not find the command line installer.I did install the IDE (on WIndows XP).May target is to run the sikuli script (test.py) from command line using python.
I am successfully able to run the command using Sikuli-ide.exe -r test.sikuli , but i need to run it as python command.
So i was following the instructions on above post - but could not find the installer for command line tool, to finish up the steps.

Thanks
Anshu

Question information

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

You cannot run Sikuli script contained .py with the real Python interpreter. It is only the language that is compatible. The Interpreter, that is used internally is Jython (which is a language and standard module compatible port of Python on Java) (the main stuff of Sikuli is based on Java).

It is possible to use Jython on the command line, to run the scripts .py. But that is not a trivial job. come back, if you are really interested. Otherwise use Sikuli just as it comes.

Your question:
There is no special command line tool. Just use the Sikuli-IDE.bat (you find it in the program folder) in a command window.

The specification: http://groups.csail.mit.edu/uid/sikuli/download.shtml chapter "command line" in the lower part of the page.

On the same page you can find a so called "portable version", that is not "installed" (no registry usage) and has to be run using the .bat. But it is not really needed, if you don't plan to use Sikuli e.g. from a stick on different systems, without installation (only the JRE has to be installed).

If interested in more information on using sticks to run Sikuli, read through bug 667568.

By the way: the post you went through is a bit behind the time. Using the standard unittest module instead of the Sikuli unit test feature is no problem now without any special things to do. You even can run the tests now as .skl from command line (option -t).

have fun.

Revision history for this message
Anshu (anshu-ca) said :
#2

Hi RaiMan,
Thanks for the reply.
I did find a workaround for my issue.
Since my requirement was to run teh sikuli script using Python, so i created another Python script with 2 lines , that had a command to execute the Sikuli script from command line.
So something like this :

#This is the Master script to call sikuli script
import subprocess
import sys

def RunSikuliScript(sikuliscriptname):
 subprocess.Popen('"C:\Program Files\Sikuli\Sikuli-ide.exe" -r ' + sikuliscriptname, shell=True)

if __name__ == '__main__':
  RunSikuliInstaller(sys.argv[1])

----------------------------------------------------------------------------------------
It worked perfect and solved my issue. :)

Thanks Again
Anshu