http://www.perlmonks.org?node_id=850565


in reply to Wrap around an interactive python script

It may be a line buffering issue in upload.py; how could I force autoflush on it if this is the case?

If you set $| = 1; in Perl, and assuming that STDOUT is the default file handle, then that should be inherited by the python program. Otherwise (forgive me monks for I have sinned) in Python you can
sys.sysout.flush()
although I admit that is not an autoflush.

Replies are listed 'Best First'.
Re^2: Wrap around an interactive python script
by afoken (Canon) on Jul 21, 2010 at 09:01 UTC

    I don't think so. Autoflushing output happens in the C runtime library (libc/glibc) or even above that, and the auto flush flag is also a thing of the C runtime library or the interpreter or application above that. It is not part of the O/S information about the file handle, and so it does not survive the exec() system call. You have to enable autoflushing in Python (or any other application you start).

    The flag does survive a fork(), like any other simple variable does.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)