Python script monitoring another process

Magnus Bjornsson magnus at cs.brandeis.edu
Thu Jan 27 13:09:44 EST 2000


Hi all,

I'm new to Python so this is probably a typical newbie question...
Anyway, I'm trying to build a Python script which does the following:
 1. starts a process (that's easy)
 2. checks the output from the process (from its stdout)
 3. when a certain token is found in the process' output the script 
    sends a new token to the process' stdin

So, how can I redirect the process' stdout so I can manipulate it in the
Python script?  And how can I redirect my scripts stdout to the process'
stdin?
Using sys.stdin doesn't seem to do the trick since it doesn't affect the
environment for the running process...

Any help would be appreciated,
- magnus e.



More information about the Python-list mailing list