By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

Truncated file without unbuffered mode

P: n/a
I use a simple python script to monitor downloads from my website.
http://www.voidspace.org.uk/python/cgi.shtml#downman

It serves the file in a loop using our old friend :

``sys.stdout.write(chunk)``

(After sending the relevant headers with filename and filesize of
course).

I am testing this locally under windows using Xitami as localhost. If I
run in unbuffered mode (shebang line ``#!/usr/bin/python -u``) it works
fine. Without unbuffered mode (shebang line ``#!/usr/bin/python``) it
truncates the file.

This happens even if I add ``sys.stdout.flush()`` into the loop.

Does anyone know why this might happen ?

Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.