Popen3 on Windows
reed
reedobrien at gmail.com
Sun Jun 18 21:20:39 EDT 2006
Jeffrey Barish wrote:
> I have an application that has been working fine on Linux, but now I need to
> port it to Windows XP. The program uses Popen3 to run another program. I
> use Popen3 so that I can access the pid attribute, which I use to kill the
> auxiliary program when necessary. Popen3 does not exist on Windows. I see
> os.popen2 and os.popen3, but they provide only file objects for stdin,
> stdout, and stderr so I don't see a way to kill the auxiliary program that
> I start. Is there a way to do this on Windows?
> --
> Jeffrey Barish
>>>import subprocess
>>>x = subprocess.Popen('nc -l 22222')
>>>x.pid
2783
>>>subprocess.Popen('taskkill %s' % x.pid)
<subprocess.Popen object at 0x0184D410>
>>> x.poll()
1
More information about the Python-list
mailing list