Cannot open xlrd module in Sikuli

Bug #1687013 reported by Dinesh Pawar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Confirmed
Undecided
Unassigned

Bug Description

Hi, I am using Sikuli tool in Window 7.
I am start to use sikuli before two week, I have some work copy cell string or number from Excel 2013 to paste Other application.
seen last 2 days i am trying to Import "xldr" in Sikuli. But I cant I read all previous comments and problem on same issue . i am trying
all ways copy xldr(try version 1.0 .1 and 0.9.3) folder paste in install directory /sikuli x/ libs , also give path using

in your script add:
dir_xlrd = "absolute path to the xlrd directory"
if not dir_xlrd in sys.path: sys.path.append(dir_xlrd)
import xlrd

I am install JRE7U84 but still not solve

i wright code only
import xldr

it show same error

>>> import xlrd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\SikuliX\Lib\xlrd\__init__.py", line 397
    if peek == b"PK\x03\x04": # a ZIP file
               ^
SyntaxError: no viable alternative at input '"PK\x03\x04"'

please help It too important for me I am stuck on that be appreciated.......

Revision history for this message
RaiMan (raimund-hocke) wrote :

use latest SikuliX version 1.1.1, which has xlrd bundled.

so simply using

import xlrd

should work.

be sure to setup with Jython 2.7.

Revision history for this message
Dinesh Pawar (dineshpawar22) wrote :

Thanks RaiMan for your reply . still i don't know how to setup with Jython 2.7 , Anyway I will google this, if problem still not solve hope you be here.

Revision history for this message
Q17 (squery) wrote :

Hi RaiMan,

I have install xlrd but when I run this code:

import xlrd

book = xlrd.open_workbook('Excel.sikuli/myfile.xls')
worksheet = workbook.sheet_by_name('Sheet 1')
sheet.cell(0,0).value

there is an error says:[error] NameError ( name 'workbook' is not defined )

I am using Sikuli 1.1.1, Python27 and Jython 2.7.

Could you please let me know how to resolve this?

Thanks

Revision history for this message
RaiMan (raimund-hocke) wrote :

book = xlrd.open_workbook('Excel.sikuli/myfile.xls')
worksheet = workbook.sheet_by_name('Sheet 1')

since you named your xls-object
book = xlrd.open_workbook('Excel.sikuli/myfile.xls')

you have to use
worksheet = book.sheet_by_name('Sheet 1')

Sorry, but this is either basic Python knowledge or can be solved by consulting the docs of an offending module.

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.