use os.kill(pid, 0) instead of ps to check process