How about using subprocess.Popen( ... ).wait()? I believe subprocess.call() will wait until the process is finished, too.
The subprocess module is meant to replace spawn, popen2, os.system() etc. if I'm not mistaken. Take a look at this excellent resource I've used numerous times: http://www.python.org/dev/peps/pep-0324/ Hope this helps. .james :) On Oct 27, 2007, at 4:08 PM, 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? > > > > On 10/27/07, Eric Walker <[EMAIL PROTECTED]> wrote: > disregard this one. I found the answer. I was using spawn instead > of os.system. > > Thanks. > > > ----- Original Message ---- > From: Eric Walker < [EMAIL PROTECTED]> > To: tutor@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? > > Thanks > Python Newbie > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > > > -- > Configuration > `````````````````````````` > Plone 2.5.3-final, > CMF-1.6.4, > Zope (Zope 2.9.7-final, python 2.4.4, linux2), > Five 1.4.1, > Python 2.4.4 (#1, Jul 3 2007, 22:58:17) [GCC 4.1.1 20070105 (Red Hat > 4.1.1-51)], > PIL 1.1.6 _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor