Killing children

Peter Hansen peter at engcorp.com
Fri Aug 6 16:51:53 EDT 2004


Laura Conrad wrote:

> p = os.spawnl(os.P_NOWAIT, "/usr/bin/python", "python", "hobo.py", '/dev/ttyS0', 5)
> print p
> 
> os.system("ps")
> time.sleep(60)
> os.system("kill %d" % p)

This suggests that you believe the return value from os.spawnl() is
actually the PID.  Unfortunately that doesn't appear to be the case
on Windows.  See the note in the doc-string for my code sample from
the previous post (on Windows spawn* actually returns a "handle",
not the PID itself, and apparently turning the one into the other
is non-trivial).

-Peter



More information about the Python-list mailing list