Importing python modules into Sikuli

Asked by Alan Dale

Hi Guys,

Sorry if this has been answered before, i had a browse but couldn't find anything with a working solution.

I'm running all of my Sikuli tests in a separate IDE and have pretty much got everything up and running how i need it. However, i am now looking to use other python modules in my tests.

I have installed the Requests module into python and can successfully use this when writing scripts outside of the sikuli framework. If i try to use the requests module in Sikuli i get an error saying requests module is not defined.

Any idea's on if this is possible to use this module within the skiluli framework?

Cheers
Alan.

Question information

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

Sikuli only TALKS Python, but the Interpreter is Jython (Java based).

So if a Python module (made for the C-Python interpreter or for the language level beyond 2.5) is not ported to Jython 2.5.2 (used with Sikuli), then these modules can only be used with Sikuli, if they are written in Python language only (like e.g. xlrd) and using features of the language level <= 2.5

So I guess your Requests module is made for the C-based Python interpreter and contains some C/C++-based stuff.
If this is the case: sorry, no chance.

Try to find out, wether there are alternatives available with Jython.

As a last chance: Since you can use plain Java from within Jython scripts (the classes/jars need only to be on class path), one could find out, wether there is a Java solution/package that meets your requirements.

Revision history for this message
Alan Dale (adale3g) said :
#2

Poop! That's cool. There are alternatives that will work with Sikuli (urllib, urllib2) but they aren't as user friendly to use.

I guess i'll just have to work with them :)

Cheers for the speedy reply!