← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #288871]: issue regarding pypyodbc package in python

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Be aware, that you only use the Python language (level 2.7 with SikuliX 1.1.0+), but not the Python interpreter.
To run the scripts, SikuliX internally uses the bundled Jython interpreter, that is Java based and does not accept to import Python modules, that are directly or indirectly C-based.

Your Python environment, that you might have on your machine in
parallel, is completely separated and has nothing to do with SikuliX.

in the case of the mentioned pypyodbc: it internally uses C-types, which
are not available in Jython and hence not in SikuliX. This usually leads
to import errors, that might not directly point to this reason.

Additionally in your case: you have pypyodbc in a place, that is not in the sys.path of SikuliX.
But if you would have it corretly placed, you would get:
[error] script [ importTest ] stopped with error in line 3
[error] AttributeError ( 'module' object has no attribute 'c_wchar' )
[error] --- Traceback --- error source first
line: module ( function ) statement 
68: pypyodbc ( <module> ) SQLWCHAR_SIZE = ctypes.sizeof(ctypes.c_wchar)
[error] --- Traceback --- end --------------

which shows the problem.

a possible solution:
use an odbc access variant, that is available in Jython for your case.
The search item is jdbc.
The needed zxJDBC.jar is already bundled in SikuliX and available on sys.path for import.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.