[Tutor] system call

Ricardo Aráoz ricaraoz at gmail.com
Sat Oct 27 23:16:33 CEST 2007


John wrote:
> I have the exact same situation, but system doesn't seem to wait. Here
> is my pseudo code:
> 
> for i in attempts:  #attempts holds strings of shellscripts
>         cmd="%s which runs many different shell scripts and takes about
> an hour" % (i)
>         os.system(cmd)
>         #debugging
>         print "Finished with %s" % (i)
>         raw_input("More debugging, shouldn't see this until shell
> scripts are finished!")
> 
> 
> But it prints the print statement and waits for raw_input instantly...
> Any thoughts?
> 

Have you tried os.spawnl(...) with mode os.P_WAIT ?

> 
> 
> On 10/27/07, *Eric Walker* <sli1que at yahoo.com
> <mailto:sli1que at yahoo.com>> wrote:
> 
>     disregard this one. I found the answer. I was using  spawn instead
>     of os.system.
> 
>     Thanks.
> 
> 
>     ----- Original Message ----
>     From: Eric Walker < sli1que at yahoo.com <mailto:sli1que at yahoo.com>>
>     To: tutor at python.org <mailto:tutor at python.org>
>     Sent: Saturday, October 27, 2007 9:55:05 AM
>     Subject: [Tutor] system call
> 
>     Hello,
>     I am trying to run a timing script but I need the python program to
>     stop and wait for the executable to finish. Does anyone have any
>     examples of doing this?
> 


More information about the Tutor mailing list