Re: subprocess question re waiting

2013-04-08 Thread Dylan Evans
On Mon, Apr 8, 2013 at 10:22 PM, Dave Angel wrote: > On 04/08/2013 08:01 AM, Dylan Evans wrote: > >> On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin < >> al...@dpt-info.u-strasbg.fr >> >>> wrote: >>> >> >> loial writes: >>> >>> I want to call a child process to run a shell script and wait for

Re: subprocess question re waiting

2013-04-08 Thread Dave Angel
On 04/08/2013 07:00 AM, loial wrote: I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? Any help appreciated. import subprocess command = "/home/john/myscript" proces

Re: subprocess question re waiting

2013-04-08 Thread Dave Angel
On 04/08/2013 08:01 AM, Dylan Evans wrote: On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin wrote: loial writes: I want to call a child process to run a shell script and wait for that script to finish. Will the code below wait for the script to finish? If not then how do I make it wait? [.

Re: subprocess question re waiting

2013-04-08 Thread Dylan Evans
On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin wrote: > loial writes: > > > I want to call a child process to run a shell script and wait for that > > script to finish. Will the code below wait for the script to finish? > > If not then how do I make it wait? > [...] > > process = subprocess.Pop

Re: subprocess question re waiting

2013-04-08 Thread Alain Ketterlin
loial writes: > I want to call a child process to run a shell script and wait for that > script to finish. Will the code below wait for the script to finish? > If not then how do I make it wait? [...] > process = subprocess.Popen(command, > stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=su

Re: subprocess question

2011-12-12 Thread Nobody
On Sun, 11 Dec 2011 22:02:23 -0800, Chris Rebert wrote: > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', > stdout=subprocess.PIPE) > Alternatively, you can opt to use the shell by passing shell=True as > an argument. Except that the OP is talking about a directory passed

RE: subprocess question

2011-12-12 Thread jyoung79
> import subprocess > p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', >> stdout=subprocess.PIPE) > out, err = p.communicate() > out >> ' 11M\t.\n' > You might prefer to use subprocess.check_output(); it slightly > simplifies your code: > http://docs.python.or

Re: subprocess question

2011-12-11 Thread Chris Rebert
On Sun, Dec 11, 2011 at 8:39 PM, wrote: > Wondering if anyone could shed some light on the subprocess module?  I'll > admit I'm not that great at the shell. > > If I was wanting to get the size of the trash (on OS X), I could use: > os.system('du -sh ~/.Trash/') >  11M    /Users/jay/.Trash/

Re: subprocess question

2011-12-11 Thread Andrew Berg
On 12/11/2011 10:39 PM, jyoun...@kc.rr.com wrote: > And another question - why can't I use the tilde as a shortcut to the home > directory? Because subprocess doesn't use the shell (which is what expands the tilde to the invoking user's home directory). I recommend using os.path.join and os.enviro