It's just magic, and I hate it ...

Andrew Dalke dalke at bioreason.com
Tue Jun 22 21:19:29 EDT 1999


Mitchell Morris <mmorris at mindspring.com> asked:
> Are you [Charles G Waldman] saying that this worked for you? Or
> was this a guess?

I'm going to guess that that was a guess because I was
guessing the same thing... I guess.

What you described is a classic indication of buffered output.
There are three places I can think of where your output could
be buffered:
  1) in python
 stdout can be buffered, unbuffered, or line buffered, depending
on the situation, eg, if output is a tty or a pipe.  That's why
you would want to start python with -u since running from the
command line is running from a tty while the program talks to
the web server using a pipe.  To be on the safe side, try calling
flush().

  2) in the web server.  From the Apache FAQ
http://www.apache.org/docs/misc/FAQ.html#nph-scripts
 that's likely not the case because versions 1.3 and later don't
do an intermediate buffer, but you didn't say what web server
you are using nor the version number.  That documentation may
describe what to do.

  3) in the client.  I don't recall if you have to give a
special header to specify that the data should be read and parsed
straight up.  I've never done this so I don't know what to do
next.

						Andrew
						dalke at acm.org




More information about the Python-list mailing list