In article <mailman.353.1283398245.29448.python-l...@python.org>, Astan Chee <astan.c...@al.com.au> wrote: >Chris Rebert wrote: >> >> import os >> import psutil # http://code.google.com/p/psutil/ >> >> # your piece of code goes here >> >> myself = os.getpid() >> for proc in psutil.process_iter(): > >Is there a way to do this without psutil or installing any external >modules or doing it from python2.5?
Lightly edited code I wrote yesterday: cmd = ['ps', '-eo', 'pid,ppid'] output = Popen(cmd, stdout=PIPE).communicate()[0] output = output.split('\n')[1:] # skip the header for row in output: if not row: continue child_pid, parent_pid = row.split() if parent_pid == str(pid): child_pid = int(child_pid) os.kill(child_pid, signal.SIGUSR1) -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box." --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list