Help needed for getting xlrd to work

Asked by Kane

I'm having difficulties to get xlrd to work in Sikuli. Advice needed!

Here are the versions I tried:

- SikuliX 1.0.1
- xlrd 0.9.3 (couldn't get 0.7.1 to work either). The link of xlrd1 on the faq #2208 page is broken, so I couldn't try xlrd1
- Windows 7

Here is my installation:
- download the xlrd package
- unzip it into the folder SikuliX\Lib
- use the following statements in my Sikuli script

dir_xlrd = "D:\\SikuliX\\Lib\\xlrd-0.9.3\\xlrd"
if not dir_xlrd in sys.path: sys.path.append(dir_xlrd)
import xlrd
book = xlrd.open_workbook("D:\\Sikuli\\Excel\\sample.xls"

Note that the xlrd folder contains the __init__.py file.

The script failed on the open_workbook line. The error message is

[error] AttributeError ( 'module' object has no attribute 'open_workbook' )

Any idea where I did wrong? Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

testing with 1.0.1 and xlrd 0.9.3:
does not work at all for me (might be problem with the bundled Jython 2.5)

using SikuliX 1.1.0 I do not have any problems.
additional advantage: xlrd is already bundled and works out of the box.

So I recommend to give version 1.1.0 a try.
All you need and need to know is on the nightly build page:
http://nightly.sikuli.de/

carefully read top down!

remove everything from environment pointing to SikuliX 1.0.1!

- create a new folder for version 1.1.0
- download setup…jar to here
- double click
- select option 1
 - click setup
and wait until it has finished.

double click sikulix.jar to start the IDE.

import xlrd
book = xlrd.open_workbook("some.xls")

if you have any problems, come back

Revision history for this message
Kane (kna3ga) said :
#2

Thanks RaiMan, that solved my question.

Revision history for this message
Kane (kna3ga) said :
#3

for future visitors, I downloaded 1.1.0 nightly - the sikulisetup-1.1.0 jar, put it into a folder called sikuli-nightly, and run the command:

java -jar sikulisetup-1.1.0.jar

Followed the instructions on the screen to install.

Once installed, I changed my script, getting rid of the statements of appending dir_xldr to the sys.path. Just do the following

import xldr
book = xldr.open_workbook(...)

It worked like a charm.

Thanks RaiMan for the help!

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

Thanks for the feedback.