On Jan 27, 3:07 am, MRAB <[email protected]> wrote:
> Jay Jesus Amorin wrote:
[snip]
> > Here's the error message:
> >
> > r...@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[1]))
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.
Manual says:
"""
filename
The path to the spreadsheet file to be opened.
[snip]
file_contents
... 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[1])
Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list