Import python modules in Sikuli jar

Asked by Kunal

Hi Sir

I need to include tk module and mssql module of python in Sikuli jar. Is there a way i can do that?
I tried including python files of these modules in sikuli jar and then import it, but that didnt work.

Does that require some class file or something to be included?

Please help me out.

Regards
Kunal

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

---1. What Sikuli jar we are talking about? sikuli-ide.jar or sikuli-script.jar?

---2. you are talking about tk
if this means the standard Python tkinter module: this does not work in the Jython (Sikuli) environment, since it is C-based.

--3. you are talking about mssql
I guess the same goes for this: the standard Python interface implementations are C-based and as such not useable.

--4. What IDE are you using, to develop your Sikuli scripts?

--5. you say: including python files of these modules in sikuli jar
do you really mean "packing them into the jar file using the jar utility?

possible answers/solutions:

at --2. though I do not have experiences, I know from the web, that the standard recommendation is, to rewrite the GUI using Java GUI classes (e.g. Swing)

at --3. look my comment with question https://answers.launchpad.net/sikuli/+question/149687

at --5. Sikuli latest version allows to load prepared jar files containing both Java and Python code and have them available in the relevant paths. The concept can be found here: http://sikuli.org/docx/extensions/extensions_info.html#general-information-about-sikuli-extensions (in the lower part of the chapter - technical details)

Revision history for this message
Kunal (kunalzunjarrao) said :
#2

Yes i am talking about packing python files into the sikuli jar file, import them and use it in my sikuli script as we use datetime and other modules.

Will it require changes to be made in sikuli-ide.jar?

I want to run the script through Sikuli IDE and connect to database via mssql python module. Can you please elaborate why Python interface implementations are not useable?

Revision history for this message
Kunal (kunalzunjarrao) said :
#3

I am talking about packing python files into the sikuli-script jar file

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

--1. Can you please elaborate why Python interface implementations are not useable?
The basic features used by these modules is written in C/C++ and the Python modules provide an interface API to that C-libraries. This is as such not available in the Jython environment. The package has to be ported to the according Java-C interface (JNI). If this is not done by anyone, the original Python module is not useable in Jython (without any modification/adaption only modules totally written in Python are useable directly)

--2. There is no need to pack your code into sikuli-script.jar (and it is not recommended). Use the approach I mentioned above with my question 5.

--3. you ask: Will it require changes to be made in sikuli-ide.jar?
The Sikuli features are all in sikuli-script.jar. No need to do anything with sikuli-ide.jar, since it only contains the IDE-GUI.

Can you help with this problem?

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

To post a message you must log in.