someone knows the limit in size or rows or anything for a Workbook to
execute a save correctly?
I'm working with a Workbook with 65rows*6pages and I get the following
error:
MemoryError:
File "e:\FUENTES\informeTx\informeTxTipo2.py", line 251, in <module>
creaXLS(ficheroSalida,lasFilas)
File "e:\FUENTES\informeTx\informeTxTipo2.py", line 178, in creaXLS
book.save(nombreXLS)
File "c:\python26\lib\site-packages\xlwt-0.7.2-py2.6-win32.egg\xlwt
\Workbook.py", line 634, in save
File "c:\python26\lib\site-packages\xlwt-0.7.2-py2.6-win32.egg\xlwt
\Workbook.py", line 628, in get_biff_data
> someone knows the limit in size or rows or anything for a Workbook to > execute a save correctly?
No. It depends on too many factors.
> I'm working with a Workbook with 65rows*6pages and I get the following > error:
> > MemoryError:
page == sheet? Do you mean 65 rows or 65000 rows? How many columns and how many rows in each sheet? Is the data that you are writing in any way abnormal e.g. you are writing many text cells each of which contains a screen dump or an email message?
How much memory do you have on your computer? How much (a) real memory (b) swap space is being used by other processes? Can you increase the (a) real memory (b) swap space available to xlwt when you are trying to create this file? Are you on a *x platform with an unreasonable "ulimit"?
Have you considered using Worksheet.flush_row_data ?
"""If a large number of rows have been written to a Worksheet and memory usage is becoming a problem, the flush_row_data method may be called on the Worksheet. Once called, any rows flushed cannot be accessed or modified. It is recommended that flush_row_data is called for every 1000 or so rows of a normal size that are written to an xlwt.Workbook. If the rows are huge, that number should be reduced.""" ... taken from page 21 of the tutorial available from http://www.python-excel.org
I am having exactly the same error message. I am writing an Excel workbook (~ 430 MB size) with 30 worksheets and each up to 60,000 lines. I do a flush() every 1000 lines. As there is more data every day it now always crashes on my WinXP 32 bit system with 4 GB Ram. The python process uses ~ 500 MB ram and I have enough Ram/Swap left. When I run it under Win7 64 bit with 16 GB Ram in 32 bit Python it crashes only occasionally. So RAM size seems to play a role.
Any other ideas except for splitting the output file in two?
George
----snip---
# flushing last time currentWs.flush_row_data()
# save the whole workbook at the end wbOutput.save( cOutputFileName )
----snip---
File "H:\APPS\eclipse\workspace\generatenewfile\src\generatenewfile.py", line 193, in processZgsFiles wbOutput.save( cOutputFileName ) File "C:\Program Files\Python\lib\site-packages\xlwt\Workbook.py", line 643, in save doc.save(filename, self.get_biff_data()) File "C:\Program Files\Python\lib\site-packages\xlwt\Workbook.py", line 629, in get_biff_data sheets += data MemoryError
On Tue, Sep 4, 2012 at 6:52 AM, George <georg.wink...@googlemail.com> wrote:
> I am writing an Excel workbook
> (~ 430 MB size) with 30 worksheets and each up to 60,000 lines. I do a
> flush() every 1000 lines. As there is more data every day [...]
> Any other ideas except for splitting the output file in two?
My other idea would be to store the data in an actual database, rather
than in an Excel workbook. That is way more data than is healthy for
Excel, especially when using the .xls format.
On Thu, Sep 27, 2012 at 7:44 AM, Chris Withers <ch...@simplistix.co.uk> wrote:
> On 18/09/2012 17:14, George wrote:
>> flush_row_data is called ~ 700 times.
> That's not a very useful answer.
> How many rows are you writing between calls to flush_row_data?
Maybe he answered it that way because earlier in the thread (in his
first post) he already mentioned that he's flushing every 1000 rows.
Although, I'm not sure it adds up. He said (as I quoted before in
*my* previous post):
On Tue, Sep 4, 2012 at 6:52 AM, George <georg.wink...@googlemail.com> wrote:
> I am writing an Excel workbook
> (~ 430 MB size) with 30 worksheets and each up to 60,000 lines. I do a
> flush() every 1000 lines. As there is more data every day [...]
If there are 30 worksheets, each with 60,000 rows, and a flush every
1000 rows, then shouldn't there be more like 1800 flushes rather than
700?