Issue setting up Sikuli Eclipse

Asked by Ali Ahmed

We are having issue setting up Sikuli on Eclipse. We installed Pydev but are not able to create project and add sikuli library to it. My coworder is using Eclipse 4.20.0. In your document it says that you use Eclipse Helios 3.6 but we could not find that one online. Some assistance would be greatly appreciated.

Question information

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

Sorry for the inconvenience, but I switched from NetBeans/Eclipse many years ago to the IntelliJ IDEs (IDEA and PyCharm).

So I can give you some hints only, what should be done to get an environment running with Eclipse PyDev.

Terminate Eclipse for the next steps.

This is checked on Windows (but should be similar on macOS and Linux)

Have the latest Java 8 running.

--- get SikuliX IDE working
1. Download the 2.0.5 IDE jar and put it somewhere. You might rename it to whatever you want
2. Delete the folder C:\Users\...\AppData\Roaming\Sikulix if it exists
3. Run the IDE using
java -jar <path-to-sikulix-ide-jar> -v -c
The IDE should start up.
Run a one-liner like popup("hello").
If it works, stop the IDE (without saving anything)
If it does not work, read the debug log and identify the possible cause.

Now you should have a folder C:\Users\...\AppData\Roaming\Sikulix\Lib, which contains all the py-files needed including the stuff from Jython 2.7.2.

--- get Jython working
install Jython 2.7.2 and get it running

--- get Eclipse Pydev running
Make sure, that a newly created simple project is working with the installed Jython 2.7.2. Do not touch any SikuliX stuff for now.

Now make a new project to test the usage of SikuliX:

the main script should be something like this:
import sys
for e in sys.path: print e
from sikuli import * # this is the mandatory line!
popup("hello")
hover()
exit()

In the setup for this project or in the global setup you have to add
C:\Users\...\AppData\Roaming\Sikulix\Lib and
<path-to-sikulix-ide-jar>

so that they are on sys.path at runtime.

Now you might try to run the above main script.

In my PyCharms setup it shows:
C:\Users\rmhde\PycharmProjects\SikulixTest
C:\Users\rmhde\AppData\Roaming\Sikulix\Lib
C:\Users\rmhde\PycharmProjects\SikulixTest
C:\SXRun\_Latest\2_0_5\sikulixide-2.0.5-win.jar
C:\jython2.7.2\Lib
__classpath__
__pyclasspath__/
C:\jython2.7.2\Lib\site-packages

The double entries look ugly, but do not do any harm ;-)

In version 2.0.6 I will bring back better support for running with external Jython or non-SikuliX IDE's.

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

Additionally:

--- remove any SikuliX related stuff or references from your Eclipse Pydev before you go into the steps mentioned above.

--- It is recommended to use the SikuliX IDE for image handling. To be in line with your PyDev usage, always create a new project in PyDev and then aditionally/in parallel open the main py file in the SikuliX IDE. This would store captured images in the Project root folder.

If you are working this way with images, you have to add
setBundlePath("<project root folder>")
in the script before refencing images.

Another option is to use the ImagePath feature.

Revision history for this message
Javahir (javahir675) said :
#3

3. Run the IDE using
java -jar <path-to-sikulix-ide-jar> -v -c

On this step we tried to do it CMD and used cd command to change folder to Downloads folder where the Sikuli 2.0.5 jar file was located. But we got this message on the CMD

The system cannot find the file specified.

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

Uuups ;-)

 <path-to-sikulix-ide-jar> is a placeholder for the real path spec

So you can use the java command from whatever folder you want.

Can you help with this problem?

Provide an answer of your own, or ask Ali Ahmed for more information if necessary.

To post a message you must log in.