← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #214725]: Facing issue while importing Sikuli script in Eclipse

 

Question #214725 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/214725

    Status: Open => Answered

RaiMan proposed the following answer:
At least one problem is, that the Sikuli stuff should not be in sys.path
before the Jython 2.5.3 stuff (as already stated above).

possible solution:
- do not add sikuli-script.jar to the projects pythonpath, but to the pydev's general preferences Interpreter Jython Libraries, where  you are able to position the entry somewhere below the Jython entries.

- the  C:\sikuli-script\Lib contains Jython 2.5.2 stuff, which might
collide with your Jython 2.5.3. So the easiest workaround is to copy
only the contained folder sikuli to the folder C:\jython2.5.3\Lib or
C:\jython2.5.3\Lib\site-packages (to be preferred for general reasons).

--- your sources

see the made changes below

Samp.py:
======
import os
import sys
for e in sys.path: print e
from sikuli import *
# see comment below
myScriptPath = "C:\Users\ambigaj"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
import Desktop
#reload (Desktop) # not needed in Eclipse run

Desktop.py
=======
from sikuli import *
click("1353412358967.png")
click("File.png")
click("Exit.png")

--- comment on Sikuli import
when using
from sikuli import *
The Jython import process is intercepted by Sikuli to be able to import .sikuli folders correctly and manage the image path accordingly.
So having a folder containing .sikuli folders, that need to be imported, in sys.path is sufficient and you can just say
import Desktop
no need to specify .sikuli and no need to copy images somewhere else, they should be found.

I will now try to get Eclipse, PyDev and Jython 2.5.3 running on my
Windows system together with Sikuli X-1.0 r930.

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