AttributeError: 'module' object has no attribute 'open_workbook'
sjmachin at lexicon.net
Mon Jan 26 22:37:45 CET 2009
On Jan 27, 3:07 am, MRAB <goo... at mrabarnett.plus.com> wrote:
> Jay Jesus Amorin wrote:
> > Here's the error message:
> > root at nebuchadnezzar:/home/test/project# ./xlrd.py test.xls
> > Traceback (most recent call last):
> > File "./xlrd.py", line 3, in <module>
> > import xlrd
> > File "/home/jayam/project/xlrd.py", line 6, in <module>
> > mySpreadsheet = xlrd.open_workbook(open(sys.argv))
I concur with MRAB's diagnosis.
To answer the OP's possible next question: the first arg of
xlrd.open_workbook() is the path to the file to be opened. It won't
work with a string of data. That's what the file_contents arg is for.
The path to the spreadsheet file to be opened.
... as a string or an mmap.mmap object or some other behave-alike
object. If file_contents is supplied, filename will not be used,
except (possibly) in messages.
So the above line of code should be:
mySpreadsheet = xlrd.open_workbook(sys.argv)
More information about the Python-list