Killing children

Laura Conrad lconrad at
Fri Aug 6 23:15:13 CEST 2004

>>>>> "Peter" == Peter Hansen <peter at> writes:

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

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

So you think os.kill(p) might be the way to kill it?   But does anyone
know how to get it started right?

Laura (mailto:lconrad at , )
(617) 661-8097	fax: (501) 641-5011
233 Broadway, Cambridge, MA 02139

More information about the Python-list mailing list