Execute Jython environment preconfigured with classpath reference to Sikuli to then run any Jython/Python script?

Asked by daluu

This thought just recently occurred to me. Sikuli, the IDE at least?, already incorporates Jython, and comes with Jython interpreter shell that you can fire off that I believe lets you run Sikuli API commands.

But if one wants to run Jython/Python (not *.sikuli/*.skl) script files, they have to set up the classpath, Jython path references as well as pointing to the lib directory, etc. before they can successfully import and run some Sikuli commands in Jython script file (when such file is not part of a Sikuli script).

And the exact files & process changed a bit between old and recent versions of Sikuli I believe.

It sure would be nice to have a feature where you can use Sikuli JAR as "Jython" (with all the Sikuli referencing "predone" for you). As a replacement/alternative to standard Jython JAR/distribution. As such, starting up such a Jython environment (in this case, assumed to be not the interpreter shell but rather when you supply a Python/Jython script), any Jython script that imports any class/module from Sikuli package/namespace then should have no issues and can call the Sikuli API commands.

That would save people headache and hassle from having to much with path reference and stuff to Sikuli, especially when Jython is already built in.

Perhaps something to consider for future enhancement.

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 :
#1

Why should that be different for Sikuli than with any other library you use (e.g. Selenium) in pure Jython environments.

With version 1.0.1+ (much clearer though with 1.1.0+) you are supposed to use the library jar (sikulixapi.jar for 1.1.0) together with a helper import and you are done (see https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming). To this you also have link from the relevant paragraph on QuickStart@homepage.

When using pure Jython scripts, you have to tell Sikuli anyways where you have your images (http://sikulix-2014.readthedocs.org/en/latest/scripting.html#image-search-path-where-sikulix-looks-for-image-files), so the added value of a somescript.sikuli folder and running it with sikulix.jar is "only", that Sikuli supposes, that the images can be found in this folder too (bundlePath).

So besides slightly improving the features brought by
import org.sikuli.basics.SikulixForJython

I do not see any needed enhancements, but I am of course open to further discuss any suggestions.

Can you help with this problem?

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

To post a message you must log in.