What version of python, zope, and os? I have been able to treat them as a pure string so far in my python products in linux even with several meg ones. Python 1.5.2, zope 2.3.2, and debian linux. If you are using windows writing to a temporary file could kill you anyways because of the difference ascii/binary difference on windows. Designing the webpages of tomorrow http://webme-eng.com Designing the MMORPGS of tomorrow http://worldforge.org On Thu, 21 Jun 2001, Kyler B. Laird wrote:
I learned my lesson for today, so I thought I'd share it.
I am passing around large strings containing PDF and PS documents. Sometimes I make a call like document = container.PJdoc(container['proposal'].data) where the object "proposal" is a PDF file.
I end up writing this data to a temporary file in my PJ class. I noticed early on that I could not simply write the whole string, but I worked around that by writing it in 1K blocks.
I had my warning.
Today my dumb kludge came back to bite me. We found that some of our proposals were rejected by the PDF parser. I started looking at the temporary files and noticed the problem ones were 98798 bytes in length. The PDF file sent was much larger.
After some tests, I determined that asking for a slice from .data only returns a null string (zero length) after 98798 bytes. This meant that my little 1K write loop was happily going through the "string" but it was writing 0K blocks after awhile.
So...I finally fixed the problem. Instead of all of the 1K writing junk, I simply cast whatever is passed to me into a real string. Then I can write the whole thing without any problems.
I'm sure this is documented somewhere that I should have read before, but I'm hoping having it here too saves someone some grief.
Thank you.
--kyler
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )