XLRD Python 2.51 Question

Discussion in 'Python' started by kylancal@gmail.com, May 8, 2007.

  1. Guest

    I am trying to read an Excel book with XLRD and I am getting the
    following error

    Traceback (most recent call last):
    File "C:\temp\ReadGoldmanExcelFiles.py", line 62, in <module>
    startRow = 0, sh_idx = 0, path2 = '//otaam.com/root/SharedFiles/
    GlobeOp/Risk/Cal Projects/temp/')
    File "C:\temp\ReadGoldmanExcelFiles.py", line 36, in excelTocsv
    book = xlrd.open_workbook(infile)
    File "C:\Python25\lib\site-packages\xlrd\__init__.py", line 362, in
    open_workbook
    formatting_info=formatting_info,
    File "C:\Python25\lib\site-packages\xlrd\__init__.py", line 791, in
    __init__
    cd = compdoc.CompDoc(filestr)
    File "C:\Python25\lib\site-packages\xlrd\compdoc.py", line 122, in
    __init__
    "MSAT extension: accessing sector %d but only %d in file" % (sid,
    mem_data_secs)
    CompDocError: MSAT extension: accessing sector 1717046 but only 2887
    in file

    I am not sure what this means at all, can anyone help here? Thanks
    alot
     
    , May 8, 2007
    #1
    1. Advertising

  2. On Tue, 2007-05-08 at 08:26 -0700, wrote:
    > CompDocError: MSAT extension: accessing sector 1717046 but only 2887
    > in file
    >
    > I am not sure what this means at all


    At least superficially that sounds like the file you're trying to open
    is truncated or otherwise corrupted to the point where xlrd doesn't know
    what to do with it. What happens if you try to open the file with Excel?
    If Excel manages to open the file, maybe the file is using a storage
    format that's newer than what xlrd is prepared to handle. In that case,
    try saving the file to a different file name as another format (such as
    Excel 97) that xlrd should be able to handle.

    HTH,

    --
    Carsten Haese
    http://informixdb.sourceforge.net
     
    Carsten Haese, May 8, 2007
    #2
    1. Advertising

  3. John Machin Guest

    On May 9, 1:36 am, Carsten Haese <> wrote:
    > On Tue, 2007-05-08 at 08:26 -0700, wrote:
    > > CompDocError: MSAT extension: accessing sector 1717046 but only 2887
    > > in file

    >
    > > I am not sure what this means at all

    >
    > At least superficially that sounds like the file you're trying to open
    > is truncated or otherwise corrupted to the point where xlrd doesn't know
    > what to do with it.


    Looks like to me it's truncated or corrupted to the point where xlrd
    knows *exactly* what to do: pull the ejection handle.

    Amplifying the error message: The extension to the Master Sector
    Allocation Table appears to be referencing sector number 1717046 but
    there are only 2887 sectors in the file. The default sector size is
    512. Note that 1717046 * 512 > 800 Mb.

    > What happens if you try to open the file with Excel?
    > If Excel manages to open the file, maybe the file is using a storage
    > format that's newer than what xlrd is prepared to handle.


    There is no newer format that uses .XLS as an extension. Default from
    Excel 2007 is .XLSX (XML format -- xlrd upgrade in preparation);
    there's also a binary format (.XLSB) ...

    If Excel manages to open the file, there are two other possibilities
    (both of which have historical antecedents):
    (1) we've fallen into the 0.1% gap in openoffice.org's 99.9% brilliant
    reverse-engineering of the arcane structures in an OLE2 Compound
    Document
    (2) the file is trash an' Bill don't care :-(

    Trying to open the file with openoffice.org's Calc (version 2.1) and
    with Gnumeric is a good idea, if they are available conveniently.

    I'd suggest that the OP send a copy of the file to the package author,
    together with the following information:
    (a) version of xlrd
    (b) what platform
    (c) what version of Python
    (d) background to creation of file especially what software created it
    (e) has xlrd been used successfully before/since to open files?
    (f) does the path2 thingy in the first entry in the traceback indicate
    that the file is on a network?

    startRow = 0, sh_idx = 0, path2 = '//otaam.com/root/SharedFiles/
    GlobeOp/Risk/Cal Projects/temp/')

    If so, what happens if the file is put on a local hard drive and this
    is done:

    shell-prompt> python
    import xlrd
    xlrd.open_workbook('the_file.xls')

    HTH,
    John
     
    John Machin, May 8, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Machin
    Replies:
    15
    Views:
    790
  2. xlrd question

    , Aug 3, 2007, in forum: Python
    Replies:
    1
    Views:
    492
    John Machin
    Aug 4, 2007
  3. RE:xlrd question

    , Aug 4, 2007, in forum: Python
    Replies:
    3
    Views:
    568
    John Machin
    Aug 7, 2007
  4. Chris Withers
    Replies:
    0
    Views:
    251
    Chris Withers
    Jan 31, 2013
  5. somesh g
    Replies:
    2
    Views:
    123
    Neil Cerutti
    Sep 27, 2013
Loading...

Share This Page