Can I get use pexpect to control this process?

Saqib Ali saqib.ali.75 at gmail.com
Wed Dec 21 04:23:43 EST 2011


I have a program X that constantly spews output, hundreds of lines per
minute.
X is not an interactive program. IE: it doesn't take any user input.
It just produces a lot of textual output to STDOUT.

I would like to save the output produced by X into a different file
every 5 seconds regardless of the actual content. I want one file to
contain the output from seconds 0-5, another file should contain 6-10,
etc. etc.

Can I do this with pexpect? I'm not sure I can because the "before"
argument gives me EVERYTHING upto the most recent match. What I really
need is something that will give me what was produced between the last
2 calls to pexpect.expect().



More information about the Python-list mailing list