On Wed, May 9, 2012 at 8:35 AM, Florian Lindner wrote:
> Hello,
>
> how can I achieve a behavior like tee in Python?
>
> * execute an application
> * leave the output to stdout and stderr untouched
> * but capture both and save it to a file (resp. file-like object)
>
> I have this code
>
> proc =
You've had some good responses already, but here're two more:
1) Easiest would be to use setvbuf in the child process, if you have access
to its source. This allows you to force line-oriented buffering.
2) stdio likes to buffer to tty/pty's in a line-oriented manner, and other
things in a block-
On May 9, 2012, at 11:35 AM, Florian Lindner wrote:
> Hello,
>
> how can I achieve a behavior like tee in Python?
>
> * execute an application
> * leave the output to stdout and stderr untouched
> * but capture both and save it to a file (resp. file-like object)
>
> I have this code
>
> proc =
On Wed, May 9, 2012 at 11:35 AM, Florian Lindner wrote:
> Hello,
>
> how can I achieve a behavior like tee in Python?
>
> * execute an application
> * leave the output to stdout and stderr untouched
> * but capture both and save it to a file (resp. file-like object)
>
> I have this code
>
> proc =
On 05/09/2012 11:35 AM, Florian Lindner wrote:
> Hello,
>
> how can I achieve a behavior like tee in Python?
>
> * execute an application
> * leave the output to stdout and stderr untouched
> * but capture both and save it to a file (resp. file-like object)
>
> I have this code
>
> proc = subproces
Hello,
how can I achieve a behavior like tee in Python?
* execute an application
* leave the output to stdout and stderr untouched
* but capture both and save it to a file (resp. file-like object)
I have this code
proc = subprocess.Popen(shlex.split(cmd), stdout = subprocess.PIPE,
stderr=subpro