[Tutor] system call

Alan Gauld alan.gauld at btinternet.com
Sun Oct 28 01:12:46 CEST 2007


"John" <washakie at gmail.com> wrote

> 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 checked the return code from system is zero - ie successfuil 
execution?
If there is an error in your command string (or you have set the 
command to
execute in the backgrouynd with &) the system call will return 
immediately
with an error.

Also I assume your cmd is not really like the one above which would
always give an error!

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list