<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>Hi
List,</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2>e.g.</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>C:\> runner.exe |
script.py</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>C:\> runner.exe
> script.py # this overwrites your script!:-)</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2>e.g.</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>#!/usr/bin/env
python</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>import
re</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>while
1:</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005> <FONT face=Arial
size=2>packet = sys.stdin.read()</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005> <FONT face=Arial
size=2>if field in packet:</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005>
<FONT face=Arial size=2># change it and put it back on the command window and
get the next bunch of stuff</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005>
<FONT face=Arial size=2>sys.stdout.write()</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>I hope my
question/intention is clear.</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial size=2>Thanks to the
list! This is the best list I've ever belonged to. There are a lot
of knowledgeable people who help, and no one ever flames you for asking
questions out of ignorance.</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=480173914-08092005><FONT face=Arial
size=2>Frank</FONT></SPAN></DIV></BODY></HTML>