Hi Lawrence, In a UNIX environment the method used to determine if a process is running is to issue a "kill -0 pid". If the process is running the return value will be zero (0) and -1 with errno set to ESRCH - No process or process group can be found corresponding to that specified by pid.
THANX(MKD). -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of lawrence wang Sent: Thursday, October 13, 2005 10:30 AM To: tutor@python.org Subject: [Tutor] Getting info about processes via pid So I have a list of pids, and I want to check whether the pids still refer to live processes or not. Currently I'm doing that thus: pids = ['4550\n', ...] procs = os.popen("ps ax|grep %s|awk '{ print $1 }'" % keyword).readlines() and comparing the two lists. I'm wondering, though, if there's a way to do this that's less dependent on external programs. I thought os.waitpid() might work, but on *nix I can only call it for child processes. Lawrence Wang _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor