Sikuli X: Want to use Jython 2.5.2 with sikuli-script.jar
*** this is a how to
current release: Jython 2.5.2 (final release available since March 3, 2011)
Download link: http://
Be aware, that some things might not behave as expected:
Sikuli is tested and runs with Jython 2.5.1
If you want to use it, you have to make sure, that in sys.path the pointer to Jython/Lib comes before the entry sikuli-
You should copy sikuli-script.jar to a place, so that the resulting absolute path does not contain any blanks and use this copy in the further steps (bug 702155)
There might be many ways to do the following (depending on your environment and goals), but this at least works:
--- e.g. you have Jython in c:\Jython2.5.2 and copied sikuli-script.jar to this directory
--- set the environment variable CLASSPATH as the path to sikuli-script.jar
--- set the environment variable JYTHONPATH
set JYTHONPATH=
--- use the jython command file (Windows: jython.bat, Mac/Linux: jython) in Jython/bin to run a Sikuli script
e.g. you have a script at path-to/
jython.bat path-to/
--- comment on NetBeans/Eclipse:
If you use the Python plugins together with Jython 2.5.2 just check the generated sys.path in these environments at runtime of your script. It should be already in the correct sequence.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2011-01-13
- Last reply:
RaiMan (raimund-hocke) said : | #1 |
*** this is a how to
surfdork (surfdork) said : | #2 |
I dont understand how to configure Eclipse to use Sikuli from the instructions above.
What I need for Eclipse is enumerated steps. Eclipse is very tricky to configure, even for a seasoned developer.
I found these steps, unfortunatley I have no success following them
- installed Eclipse Helios Classic- installed the Plugin PyDev- installed Jython 2.5.1- made Jython the Interpreter in PyDev- in PyDev preferences -> PythonPath -> Ext.Libraries- a reference to sikuli-script.jar in the Sikuli program folder- a reference to the folder Lib/sikuli in the sikuli-script.jar (had to un-jar and copy the folder elsewhere)- in the script as first line:from Sikuli import *
So the question remains, is it even possible to use Eclipse with Sikuli and if so what are the working steps?
My options are to uninstall Win7x64 and replace with Win7x32 so I can continue to use Net Beans, which is a terrible IDE however it is usable.
Use another IDE. What other IDE supports using Sikuli in a x64 enviornment?
Traceback (most recent call last):
File "C:\Users\
from sikuli.Sikuli import *
ImportError: No module named sikuli
RaiMan (raimund-hocke) said : | #3 |
the above instructions are not intended to explain, how Eclipse has to be configured.
It is for people who want to use Jython 2.5.2 for whatever reasons (as the title says).
coldtest (tesger) said : | #4 |
hi,RaiMan ,I did not success, I download jython 2.5.2 and my sys.path is :
['D:\\script\\jy', 'D:\\jython2.
'__classpath__', '__pyclasspath__/', 'D:\\jython2.
I also set the jythonpath environment :
D:\script\jy>set jythonpath
JYTHONPATH=
my classpath environment is :
D:\script\jy>set classpath
CLASSPATH=
my system path environment is :
D:\script\jy>set path
Path=D:
my jython code is :
import sys
from sikuli.Sikuli import *
print sys.path
Sikuli.capture()
when I run the scipt, I meet the error:
D:\script\jy>jython test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from sikuli.Sikuli import *
ImportError: No module named sikuli
expect for your help ,thanks
coldtest (tesger) said : | #5 |
I solved the problem ,but I don't know wether it is a good way
I unzip the sikuli-script.jar to C:\sikuli-script and modify the script as :
import sys
sys.path.
print sys.path
from sikuli.Sikuli import *
capture()
It is excuted successly :
D:\script\jy>jython test.py
['D:\\script\\jy', 'D:\\jython2.
'D:\\jython2.
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
RaiMan (raimund-hocke) said : | #6 |
@ coldtest:
Yes this is a solution, but not necessary to do so.
First sorry, for the mistake in the post (I corrected it):
JYTHONPATH=
So you have the the correct sys.path as needed from beginning.
There is no need, to unzip sikuli-script.jar, since Jython accepts folder specifications inside of jar-files.
It is even possible to not copy sikuli-script.jar at all and use it at it's installation place (D:\Program Files\Sikuli\
One more thing:
CLASSPATH=
is sufficient - you do not need it twice.
coldtest (tesger) said : | #7 |
wonderful, thanks to RaiMan so much ,you are so warm-hearted , I run my script succesly as what you told
Anirban (ani-chat82) said : | #8 |
I got an Sikuli built on Win 7 64 bit platform. But while running some script from Eclipse, the problem I am seeing is, the JNI loader of Sikuli is not able to load the files Win32Util.dll and VisionProxy.dll. Hence it is showing the error " Access denied for Win32Util.dll" and throwing FileNotFoundExc
Did anyone of you come across this problem and find a workaround for this?....The most surprising part is the if I want to open Sikuli IDE in Win 7 64 bit platform, it is opening fine and also loading the vision engine when I am giving command to perform a click somewhere. But I need to use sikuli script written in java from eclipse. So just thought of asking this question before giving up the hope.
Anirban (ani-chat82) said : | #9 |
With respect to my previous post, please find below the exception that is happening:
Exception in thread "main" java.lang.
Hi RaiMan
Could you please share the link fron where I could download Jython 2.5.2
Hi,
I tried the steps mentioned as above and i get following error message. Can anybody know what should i do to correct this.
[info] Windows utilities loaded.
Exception in thread "main" java.lang.
at java.lang.
at java.lang.
at java.lang.
at java.lang.
at java.lang.
at com.wapmx.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
RaiMan (raimund-hocke) said : | #12 |
@ thuwan
additionally you need the standard Sikuli installation and its path settings:
--- Sikuli installed in e.g.
c:\Program Files\Sikuli X
--- and system path added
path-to-
@RaiMan,
Thanks for the Help. Is there any Guidance Document that we can use to Code Sikuli advanced scripts using Eclipse. It would be great if you can share some of examples in the official site..
Regards,
Shiyam
RaiMan (raimund-hocke) said : | #14 |
@ thuwan
There is no special document about using Sikuli with Jython directly or from inside Eclipse PyDev plugin.
All Sikuli script examples apply.
It is just Python programming with the special capabilities of using any Java classes directly.
The only additional aspects:
--- class-path and python-path settings according to the Sikuli docs
--- from sikuli import * needed even in the main script
--- you need an image concept for the captured images ( and might use the Sikuli IDE in parallel, to control the images ). The image support of import does not apply in this case, you have to use the image path feature.
Laanaya doha (dlaanaya) said : | #15 |
Hello i'm new in sikuli and all the configuration.So i tried to do the configuration explained before but i'm stuck in the configuration of the classpath and the jythonpath, i don't know how to do so .
thank you for you're help