[Tutor] input/output redirection

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Sep 8 20:13:55 CEST 2005

On Thu, 8 Sep 2005, Lane, Frank L wrote:

> I wanted to take the stdout of a process and redirect it to stdin of a
> python script, then after playing with the input in the script I want to
> send it back to stdout (all of this to be done while the original
> process runs happily along).  I can't seem to figure out the correct
> syntax if this is possible.
> e.g.
> C:\> runner.exe | script.py

Hi Frank,

You've almost got it.  The syntax above should have worked.  But the
problem here is that you're running into a problem with the way Windows
runs Python scripts.  Alan Gauld ran into this a few weeks ago:


You may need to put a CMD wrapper around the Python script.  Apparently,
this makes Windows pleased enough to let it be used as part of a shell
pipeline.  The thread above should mention the workaround to get things

Best of wishes!

More information about the Tutor mailing list