← Back to team overview

sikuli-driver team mailing list archive

[Question #267461]: using openpyxl (import errors)

 

New question #267461 on Sikuli:
https://answers.launchpad.net/sikuli/+question/267461

Attempting to use the excellent openpyxl module for working with Excel files (much more convenient than using the triumvirate of XLRD, XLWT and XLUtils). Have tried this both by putting a copy of the openpyxl directory in the LIB folder and by adding the Python SITE_PACKAGES folder to the sys.path.

In 1.01, the 'import openpyxl' statement returns:

     [error] SyntaxError ( ("'import *' not allowed with 'from .'", ('C:\\Sikuli\\Lib\\openpyxl\\workbook\\__init__.py', 5, 0, '')) )

I understand is a Jython issue, since Jython 2.5 specifically does not allow this type of import. 

So I tried 1.1, to see if stepping up to Jython 2.7 makes a difference. Apparently it does, because the import statement now returns 

     [error] ImportError ( No module named workbook )

So Jython 2.7 apparently does allow the 'import *' construct, and I suspect that now we're looking at a pathing issue of some sort. 

I find that by adding 'lib\openpyxl' and 'lib\openpyxl\workbook' to the sys.path, that I can generate different errors, such as"

    [error] ImportError ( Workbook.sikuli has no Workbook.py )

Now this is interesting... how did the folder 'workbook' become 'workbook.sikuli'? And in any event, there is no 'Workbook.py' because the file is named 'workbook.py', though the CLASS within is named 'Workbook'.

I'm not that proficient yet with Python (much prefer Ruby for scripting) and no next to nothing about the nasty intricacies of the Java/Jython environment so any suggestions are appreciated. I guess in the meantime I'll have to go with the XL* trio of modules... or maybe just convert our spreadsheets to CSV and go that route.

ddk

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.