Import a module inside sikulix script

Asked by ANTONIO CARLOS PAES NASCIMENTO on 2019-07-02

Hi RaiMan,

I'm using the new sikulix version, it's way better btw!

However, I don't know if what i'm trying to do it's possible, I've this python module which I'm using as a "database layer", so all I need from the database I call this script and then use this inside my sikulix script.

The problem is, this database module use the library cx_Oracle an this has some C-based code, so when I import my database layer module inside my sikulix script I got this error:

error] script [ createPurchaseOrder ] stopped with error in line 6
[error] ImportError ( No module named cx_Oracle )
[error] --- Traceback --- error source first
line: module ( function ) statement
1: getData ( <module> ) import cx_Oracle
6: main ( <module> ) import getData
[error] --- Traceback --- end --------------

My sikulix script it's like this:

database_module = "C:\\PATH\\createPurchaseOrder.sikuli\\botlib\\src\\database"

if not database_module in sys.path:
    sys.path.append(database_module)

import getData

print(getData.getPORef('rconnection_string',, '77713060'))

Do you have some suggestion?

I've a workaround as we discuss in this issue: https://answers.launchpad.net/sikuli/+question/678478

However if i can use as a import in my script could be much better!

Thanks,

Antonio

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2019-07-02
Last reply:
2019-07-03
RaiMan (raimund-hocke) said : #1

sorry, still not possible to import such C-based stuff into SikuliX scripts, since they are run with Java based Jython.

Can you help with this problem?

Provide an answer of your own, or ask ANTONIO CARLOS PAES NASCIMENTO for more information if necessary.

To post a message you must log in.