On Sat, Apr 25, 2009 at 11:35 AM, Ian Campbell <ian-campb...@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
time.sleep(1)
if p.poll() is None:
  p.terminate()

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to