[Tutor] # what do I do now to kill the the Windows program which has finished its work?

Kent Johnson kent37 at tds.net
Sun Apr 26 03:56:48 CEST 2009

On Sat, Apr 25, 2009 at 11:35 AM, Ian Campbell <ian-campbell at shaw.ca> wrote:
> I am converting a Windows ProComm script into Python and  need help.
> ;  previous Procomm  script here
> run "c:\buy.exe" taskId                ; this runs the c:\buy.exe program
> and assigns the  task identification number to the integer variable called
> "taskId"
> pause 1                                      ; wait one second
> while taskexists(taskId)                               exitTask(taskId)
>           ; kills the task
> endwhile
> ; we carry on.... the ProComm    code to completion
> How do I do the same in Python?

I think something like this, in Python 2.6 anyway:

from subprocess import Popen
import time
p = Popen("c:\\buy.exe")  # Note double slashes for backslash
if p.poll() is None:


More information about the Tutor mailing list