[wxPython] wxKill again----note for MS windows/NT

To reiterate the problem....

looking for a way to Kill a pid in windows, not in unix. All the
modules such as os.kill are only unix. Unfortunately I'm using winNT.

Any ideas...??

Grant. (da gup)

···

when will wxKill be ported to the windows version? (Hallam, Grant)
10. Re: when will wxKill be ported to the windows version?
(Cliff Wells)
11. Re: when will wxKill be ported to the windows version?
(Joshua Judson Rosen)
12. Re: when will wxKill be ported to the windows version?
(Cliff Wells)
Message: 8
From: "Hallam, Grant"
Date: Tue, 25 Jun 2002 13:06:03 -0400
Subject: [wxPython] when will wxKill be ported to the windows version?
Reply-To: wxpython-users@lists.wxwindows.org

I'm looking for an easy way to Kill an external program that is
started by
my program. It is started via a checkbox and I would like to kill
it when
the checkbox is unchecked. I capture the pid and would like to
kill it via
the pid.

Any idea's

Grant (da gup)
Message: 10
Date: Tue, 25 Jun 2002 11:15:38 -0700
From: Cliff Wells <logiplexsoftware@earthlink.net>
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] when will wxKill be ported to the windows
version?Organization: Logiplex Corporation
Reply-To: wxpython-users@lists.wxwindows.org

On Tue, 25 Jun 2002 13:06:03 -0400 > Hallam, Grant wrote:

> I'm looking for an easy way to Kill an external program that is
started by
> my program. It is started via a checkbox and I would like to
kill it when
> the checkbox is unchecked. I capture the pid and would like to
kill it via
> the pid.

Assuming you're running on a Unix OS:

import os

def run(program, *args):
   pid = os.fork()
   if pid == 0:
       os.execvp(program, (program,) + args)
   else:
       return pid

def kill(pid, signal = 9):
   os.system("kill -%d %d" % (signal, pid))

pid = run("find", "/usr")
kill(pid)

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

--__--__--

Message: 11
Date: Tue, 25 Jun 2002 14:27:10 -0400
From: Joshua Judson Rosen <rozzin@geekspace.com>
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] when will wxKill be ported to the windows
version?Reply-To: wxpython-users@lists.wxwindows.org

On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:
> On Tue, 25 Jun 2002 13:06:03 -0400 > > Hallam, Grant wrote:
>
> > I'm looking for an easy way to Kill an external program that
is started by
> > my program. It is started via a checkbox and I would like to
kill it when
> > the checkbox is unchecked. I capture the pid and would like
to kill it via
> > the pid.
>
> Assuming you're running on a Unix OS:
>
> import os
[...]
> def kill(pid, signal = 9):
> os.system("kill -%d %d" % (signal, pid))

Or you could just use os.kill :wink:

--__--__--

Message: 12
Date: Tue, 25 Jun 2002 11:28:50 -0700
From: Cliff Wells <logiplexsoftware@earthlink.net>
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] when will wxKill be ported to the windows
version?Organization: Logiplex Corporation
Reply-To: wxpython-users@lists.wxwindows.org

On Tue, 25 Jun 2002 14:27:10 -0400 > Joshua Judson Rosen wrote:

> On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:
> > On Tue, 25 Jun 2002 13:06:03 -0400 > > > Hallam, Grant wrote:
> >
> > > I'm looking for an easy way to Kill an external program that
is started
by
> > > my program. It is started via a checkbox and I would like
to kill it
when
> > > the checkbox is unchecked. I capture the pid and would like
to kill it
via
> > > the pid.
> >
> > Assuming you're running on a Unix OS:
> >
> > import os
> [...]
> > def kill(pid, signal = 9):
> > os.system("kill -%d %d" % (signal, pid))
>
> Or you could just use os.kill :wink:

Well... yeah. _If_ you wanted to do it the easy way :wink:

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

win32 extensions have a mechanism for doing this, see win32/scripts/killProcName.py

HTH,
Mike

gupsmail@shaw.ca wrote:

To reiterate the problem....

looking for a way to Kill a pid in windows, not in unix. All the modules such as os.kill are only unix. Unfortunately I'm using winNT.

Any ideas...??

Grant. (da gup)

...

···

_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/