Vizible’s Blog

Python – How to kill subprocess.Popen

Posted in Programming, Python by wearetherock on August 3, 2009

import subprocess as subp
import win32api
proc = subp.Popen('C:\\KXBMC\cshape-wii\\WiiSignal.exe', stdin=subp.PIPE, stdout=subp.PIPE, bufsize=0)
... do somting here
# kill process
win32api.TerminateProcess(int(self.proc._handle), -1)


It not work if you set shell = True
proc = subp.Popen('C:\\KXBMC\cshape-wii\\WiiSignal.exe', stdin=subp.PIPE, stdout=subp.PIPE, bufsize=0, shell = True)
Reference :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: