Unbuffered Python Scripts
I have a script that generates a really big CSV file, which I'm doing as a python script inside Zope. Problem is, at the moment it takes huge amounts of memory and time to render, partially because the output is buffered before it's sent to the browser. Is there any way to stop this python script being buffered? Ideally I'd like each print statement to be flushed directly to the client, instead of returning "printed" at the end. -- Nicholas Avenell Technical Developer
Is there any way to stop this python script being buffered? Ideally I'd like each print statement to be flushed directly to the client,
This should get you on track: http://www.google.co.za/search?q=zope+response.write j
Also, another direction you might consider is to generate the file as sort of a "batch process", just like PayPal has switched to. When you download a CSV of your financial history, PayPal generates the file in the background with a low priority and then sends you an e-mail when the file is ready to be downloaded. Not only will this will keep the user's browser from timing out, it lets you reduce server load if the computationally expensive request comes in at a peak time. You can just defer the request until the cycles are available. Gre7g On 17 Mar 2005 at 20:11, Jean Jordaan wrote:
Is there any way to stop this python script being buffered? Ideally I'd like each print statement to be flushed directly to the client,
This should get you on track: http://www.google.co.za/search?q=zope+response.write
participants (3)
-
Gre7g Luterman -
Jean Jordaan -
Nicholas Avenell