wait for an executed subprocess to complete in python
March 9th, 2009 by Lawrence David
if you call a shell process from python, your script will normally trundle along without pausing for that process to complete. if you’d like the process to finish before your script continues on, use the communicate method:
proc = sub.Popen(my_job,stdout=sub.PIPE)
stdout,stderr = proc.communicate()
thank you so much. i am still fairly new at python programming and was having a very hard time finding this information on google. i am sure this was due to my search query, but still, thanks a million man.
You could also use the wait method:
proc = sub.Popen(my_job).wait()
Your blog is pretty interesting to me and your topics are very relevant. I was browsing around and came across something you might find interesting. I was guilty of 3 of them with my sites. “99% of website managers are doing these 5 mistakes”. http://bit.ly/s7O5FK You will be suprised how simple they are to fix.