473,847 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XLRD Python 2.51 Question

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\ReadGo ldmanExcelFiles .py", line 62, in <module>
startRow = 0, sh_idx = 0, path2 = '//otaam.com/root/SharedFiles/
GlobeOp/Risk/Cal Projects/temp/')
File "C:\temp\ReadGo ldmanExcelFiles .py", line 36, in excelTocsv
book = xlrd.open_workb ook(infile)
File "C:\Python25\li b\site-packages\xlrd\_ _init__.py", line 362, in
open_workbook
formatting_info =formatting_inf o,
File "C:\Python25\li b\site-packages\xlrd\_ _init__.py", line 791, in
__init__
cd = compdoc.CompDoc (filestr)
File "C:\Python25\li b\site-packages\xlrd\c ompdoc.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 '07 #1
2 5014
On Tue, 2007-05-08 at 08:26 -0700, ky******@gmail. com 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
May 8 '07 #2
On May 9, 1:36 am, Carsten Haese <cars...@uniqsy s.comwrote:
On Tue, 2007-05-08 at 08:26 -0700, kylan...@gmail. com 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-promptpython
import xlrd
xlrd.open_workb ook('the_file.x ls')

HTH,
John

May 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
4126
by: John Machin | last post by:
I am pleased to announce a new general release (0.5.2) of xlrd, a Python package for extracting data from Microsoft Excel spreadsheets. CHANGES: * Book and sheet objects can now be pickled and unpickled. Instead of reading a large spreadsheet multiple times, consider pickling it once and loading the saved pickle; can be much faster. * Now works with Python 2.1. Backporting to Python 2.1 was partially
11
2578
by: Tempo | last post by:
Hello. I am getting the error that is displayed below, and I know exactly why it occurs. I posted some of my program's code below, and if you look at it you will see that the error terminates the program pre-maturely. Becasue of this pre-mature termination, the program is not able to execute it's final line of code, which is a very important line. The last line saves the Excel spreadsheet. So is there a way to make sure the last line...
2
2438
by: BrendanC | last post by:
I've started learninhg Python and have developed a small Python app that imports Excel data into an Access mdb/jet database. This application has dependencies on the following: XLRD - http://cheeseshop.python.org/pypi/xlrd/0.5.2 - (to read Excel files) Python windows extensions - http://starship.python.net/crew/mhammond/win32/ - to use ADO wxPython GUI toolkit - http://www.wxpython.org/ - for the GUI interface
1
2239
by: JYOUNG79 | last post by:
When running 'python setup.py install' to install items for xlrd to work, does anybody know what items are installed and where items are installed at on a Mac (OS 10.4)? I'm assuming it mainly uses things out of the xlrd folder, but was curious if it copies files to other locations. Thanks. Jay
1
1646
by: Kelie | last post by:
Hello, I tried using xlrd to read an Excel file and kept getting this error: AttributeError: 'Book' object has no attribute 'mem' AttributeError: 'Book' object has no attribute 'mem' AttributeError: 'Book' object has no attribute 'mem'
1
7936
by: Krishna | last post by:
I want to delete some rows (by creating a loop may be) using xlrd. Is this possible, if not how do I do that with python? Please help Thanks Krishna
3
19331
by: Chanman | last post by:
This is probably a simple question to most of you, but here goes. I've downloaded the xlrd (version 0.6.1) module and placed in in the site-packages folder. Now, when I write a script, I type: import sys import xlrd When I run it, there is an import error saying there is no module named xlrd. However when I type sys.path, the site-packages folder is definitely in the path. Do I somehow need to run the xlrd setup.py
1
4182
by: Edwin.Madari | last post by:
here is working code that will read & display contents of all rows & columns in all the sheets, you need xlrd 0.6.1 import xlrd, os, sys book = xlrd.open_workbook(sys.argv) print "The number of worksheets is", book.nsheets for shx in range(book.nsheets): sh = book.sheet_by_index(shx) print 'tab:%s rows:%s cols:%s ' % (sh.name, sh.nrows, sh.ncols) for rx in range(sh.nrows):
2
9731
by: patrick.waldo | last post by:
Hi all, I am trying to figure out a way to read colors with xlrd, but I did not understand the formatting.py module. Basically, I want to sort rows that are red or green. My initial attempt discovered that text:u'test1.txt' (XF:22) text:u'test2.txt' (XF:15) text:u'test3.txt' (XF:15) text:u'test4.txt' (XF:15) text:u'test5.txt' (XF:23)
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10981
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10706
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7879
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.