Sikuli: "[error] ImportError ( No module named xlsxwriter )". Any way to get xlsxwriter to work?

Asked by Sam on 2017-07-26

Xlsxwriter is working in my other non-sikuli scripts, but not in Sikuli. This is the first time I've had trouble with a Sikuli import.

Should this be working and is there some fix for this?

Thank you

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Sam
Solved:
2017-07-28
Last query:
2017-07-28
Last reply:
2017-07-27

This question was reopened

  • 2017-07-26 by Sam
RaiMan (raimund-hocke) said : #1

I guess, the mentioned module only works with Python, since it contains some C-based libraries internally.

Python modules only work with Sikuli(X) if they are completely written in Python language and do not depend on any C-based/native stuff.

The reason behind: Jython (used with Sikuli(X)) is a Java-based Python interpreter.

In your case:
the SikuliX version 1.1.x has the xl.... modules bundled, that are working in Sikuli scripts.

see faq 2208

Sam (staffo08) said : #2

It says here that it should work with jython though:
https://pypi.python.org/pypi/XlsxWriter

I've also tried using pandas : https://pypi.python.org/pypi/pandas/

And this import does not work either. Are there any imports that you can think of that will work with sikuli/jython. I'm surprised xlxswriter isn't working since it says it works with jython in the documentation.

Thanks

RaiMan (raimund-hocke) said : #3

Are you on SikuliX 1.1.1, to be sure you are using Jython 2.7 ?

Read this to be sure that SikuliX/Jython finds the stuff:
http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#access-python-packages-from-sikulix-scripts-run-by-sikulix-gui-or-commandline

... and yes, the Jython import works well, since otherwise nothing would work at all ;-)

Sam (staffo08) said : #4

thanks, i'll try using the csv import for now

Sam (staffo08) said : #5

thanks, i'll try using the csv import for now

Sam (staffo08) said : #6

Perhaps, I'd be better off running the python panda script outside of sikuli. Is that common practice/ easy to do? I've never had sikuli run a python script for me. Perhaps Ill try something like this

RaiMan (raimund-hocke) said : #7

--- running the python panda script outside of sikuli
yes, is easy: use subprocess.popen

Sam (staffo08) said : #8

Thanks!