How to pipe from python script to system process that script starts
Hi all,
This will be sort of involved....
I'm wanting to learn python so I'm starting with projects that I want to
automate at work. What I want to do in this specific instance is use a
python script to call exipick to find all frozen messages in the Exim
queue, then feed the message id's to something such as "exim -Mvh" so I
can look at the message headers.
So far I've been able to get everything working except for how to get my
python script to be able to pass the message id's to the exim command as
the needed single parameter. I'm assuming that a pipe is the logical
way to do this, but just haven't found any kind of example for what I am
wanting to do. My Python reference book is just a little too cryptic
for me yet and "Learning Python" barely touches on piping. All the
examples there are on how to pipe from stdin with sys.stdin and that
won't work for this task.
So far I've coded everything as process oriented rather than object
oriented as that is what I am familiar with, but I'm beginning to
believe that using classes is probably the way to go as it would be much
easier to abstract concepts out that way. If someone has an example or
two they could share with me on how to do interprocess piping in either
oo or process oriented, or both, manner I would appreciate the help.
And, yes, I know, I could have done this very simply with a bash script,
but that is not the point. I'm doing this as much to learn python as I
am to accomplish the task. So, please, no tips on how to do this in a
bash script. I already know how to do that. I'm just very much a
Python noob at the moment....
Reply to: