AttributeError: 'module' object has no attribute 'open_workbook'

John Machin sjmachin at
Mon Jan 26 22:37:45 CET 2009

On Jan 27, 3:07 am, MRAB <goo... at> wrote:
> Jay Jesus Amorin wrote:
>  > Here's the error message:
>  >
>  > root at nebuchadnezzar:/home/test/project# ./ test.xls
>  > Traceback (most recent call last):
>  >   File "./", line 3, in <module>
>  >     import xlrd
>  >   File "/home/jayam/project/", 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:
    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[1])


More information about the Python-list mailing list