← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #261686]: How to integrate sikuli with an already existing python framework

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
SikuliX cannot be used as imports in Python, since the runtime of the
SikuliX stuff depends on Java and hence needs the Jython interpreter to
run.

Currently the easiest way is to spawn the scriptrun into a subprocess using a command like
java -jar <path-to>sikulix.jar -r someScritpt.sikuli -- userparms

For communication back and force you can use the different in/out
streams or files.

With this solution you have to live with the startup time of up to 5
seconds with every scriptrun. So it is not really suitable for short
actions run with Sikuli, but only for longer parts.

For a more direct interface, you might setup any kind of server running
Sikuli, that accepts commands/scripts as input and runs them
immediately. The easiest solution here is to use XML-RPC (the client in
Python, the server is a suitable Sikuli script).

... and last but not least, you might use a bridge like
https://github.com/kivy/pyjnius, that allows to directly access the
SikuliX Java API from Python code.

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