!! Non blocking IO !!

Pierre Saloni me at nospam.com
Thu Sep 30 06:56:01 EDT 1999


Hello,


>I don't know what you mean with "non-blocking", but according to the
>Perl manpage, the $| variable determines whether to flush the file
>after every output operation.
>
>$| = 0 means do NOT flush after every operation, and this is the default.
>Actually, that's also the way things work in Python; you have to flush
>the buffers explicitely. Use the flush() method on the file object if you
>want the $| = 1 effect.


    Yes it is right ... sorry, i meant $|=1 ...
    In fact what I want is an autoflush when I print, i do not want print to
bufferize at all.
    I did this in perl, but cannot find the right way in python.

>
>There's one caveat, which might have triggered the question: the Python
>interpreter flushes (at least) stdout just before printing the prompt.
>
>So if you print just a single character 'a' with:
>print 'a',
>then you will see it appear immediately.
>

    Sorry but it seems not to work, at least on my programm, I am writing
cgi scripts, and I can see the result of my 'prints' only at the end...
    I may have done a big mistake, or perhaps the problem is not where i
though, but anyway, it is the same result for me :(

>
>Hope this helps,


    I'm afraid not :( But thanks anyway for your answer !

>Stephan

P. Saloni.






More information about the Python-list mailing list