Re: [Tutor] Having a return when subprocess.Popen finishes

2010-07-08 Thread Payal
On Thu, Jul 08, 2010 at 09:04:54AM -0400, Paul VanGundy wrote: > Hi All, > > I'm trying to get data from subprocess.Popen. To be specific, I am > trying to read a ping echo and take the output and assign it to a > variable like below: > > ping = subprocess.Popen("ping -c 5 %s" % (server), > stdou

Re: [Tutor] Having a return when subprocess.Popen finishes

2010-07-08 Thread Nick Raptis
subprocess.Popen is a class, and as such it returns an object which can do a lot of stuff besides just reading the output. What you want to do here is using it's communicate() method as such: output, errors = ping.communicate() Also, there is a quicker way, I think from version 2.7 forward: u

[Tutor] Having a return when subprocess.Popen finishes

2010-07-08 Thread Paul VanGundy
Hi All, I'm trying to get data from subprocess.Popen. To be specific, I am trying to read a ping echo and take the output and assign it to a variable like below: ping = subprocess.Popen("ping -c 5 %s" % (server), stdout=subprocess.PIPE, shell=True) However, when I run the command the output that