basic python-unix question

Ed T spi at micro.soft
Wed Jul 18 17:51:25 EDT 2001


Hi Folks,
New to Python and have been unable to us the "ps ef |grep" command
correctly. From what I can tell I need to use the os.system() command. But
have had no luck. Here an example of a basic script:

import os, sys
process = ("test1", "test2")

for eachProcess in process:
     os.system('ps ef | grep eachProcess')


The idea is to place processes that should be running into a for loop and
see if it is running. When I do the above it appears only to check for the
word "eachProcess" not for the process (i.e., test1 or test2). Is this a
case of how to enter this command where substitution takes place in Python?
What am I doing wrong?

Thanks in advance!

Ed





More information about the Python-list mailing list