Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Wrap around an interactive python script

by cdarke (Prior)
on Jul 21, 2010 at 07:54 UTC ( #850565=note: print w/replies, xml ) Need Help??


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". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://850565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2021-10-26 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (90 votes). Check out past polls.

    Notices?