Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-18 Thread jkn
Hi Hans [...] > > > However, once he does that, it's simpler to cut out xargs and invoke > > "sh" directly. Or even cut out "sh" and "test" and instead use > > os.path.isfile and then call md5sum directly. And once he does that, > > he no longer needs to worry about single quotes. > Yes i

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-14 Thread Hans Mulder
On 13/11/12 22:36:47, Thomas Rachel wrote: > Am 12.11.2012 19:30 schrieb Hans Mulder: > >> This will break if there are spaces in the file name, or other >> characters meaningful to the shell. If you change if to >> >> xargsproc.append("test -f '%s/{}'&& md5sum '%s/{}'" >>

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-13 Thread Thomas Rachel
Am 12.11.2012 19:30 schrieb Hans Mulder: This will break if there are spaces in the file name, or other characters meaningful to the shell. If you change if to xargsproc.append("test -f '%s/{}'&& md5sum '%s/{}'" % (mydir, mydir)) , then it will only bre

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-13 Thread Thomas Rachel
Am 09.11.2012 02:12 schrieb Hans Mulder: That's what 'xargs' will do for you. All you need to do, is invoke xargs with arguments containing '{}'. I.e., something like: cmd1 = ['tar', '-czvf', 'myfile.tgz', '-c', mydir, 'mysubdir'] first_process = subprocess.Popen(cmd1, stdout=subprocess.PIPE)

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans [...] > > >         xargsproc.append("test -f %s/{} && md5sum %s/{}" % (mydir, > > mydir)) > > This will break if there are spaces in the file name, or other > characters meaningful to the shell.  If you change if to > >         xargsproc.append("test -f '%s/{}' && md5sum '%s/{}'" >      

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 18:22:44, jkn wrote: > Hi Hans > > On Nov 12, 4:36 pm, Hans Mulder wrote: >> On 12/11/12 16:36:58, jkn wrote: >> >> >> >> >> >> >> >> >> >>> slight followup ... >> >>> I have made some progress; for now I'm using subprocess.communicate to >>> read the output from the first subprocess,

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans On Nov 12, 4:36 pm, Hans Mulder wrote: > On 12/11/12 16:36:58, jkn wrote: > > > > > > > > > > > slight followup ... > > > I have made some progress; for now I'm using subprocess.communicate to > > read the output from the first subprocess, then writing it into the > > secodn subprocess. T

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
On Nov 12, 4:58 pm, Rebelo wrote: > Dana četvrtak, 8. studenoga 2012. 19:05:12 UTC+1, korisnik jkn napisao je: > > > Hi All > > >     i am trying to build up a set of subprocess.Ponen calls to > > > replicate the effect of a horribly long shell command. I'm not clear > > > how I can do one part of

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Rebelo
Dana četvrtak, 8. studenoga 2012. 19:05:12 UTC+1, korisnik jkn napisao je: > Hi All > > i am trying to build up a set of subprocess.Ponen calls to > > replicate the effect of a horribly long shell command. I'm not clear > > how I can do one part of this and wonder if anyone can advise. I'm o

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread Hans Mulder
On 12/11/12 16:36:58, jkn wrote: > slight followup ... > > I have made some progress; for now I'm using subprocess.communicate to > read the output from the first subprocess, then writing it into the > secodn subprocess. This way I at least get to see what is > happening ... > > The reason 'we' w

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
slight followup ... I have made some progress; for now I'm using subprocess.communicate to read the output from the first subprocess, then writing it into the secodn subprocess. This way I at least get to see what is happening ... The reason 'we' weren't seeing any output from the second call (th

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-12 Thread jkn
Hi Hans thanks a lot for your reply: > That's what 'xargs' will do for you.  All you need to do, is invoke > xargs with arguments containing '{}'.  I.e., something like: > > cmd1 = ['tar', '-czvf', 'myfile.tgz', '-c', mydir, 'mysubdir'] > first_process = subprocess.Popen(cmd1, stdout=subproces

Re: how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-08 Thread Hans Mulder
On 8/11/12 19:05:11, jkn wrote: > Hi All > i am trying to build up a set of subprocess.Ponen calls to > replicate the effect of a horribly long shell command. I'm not clear > how I can do one part of this and wonder if anyone can advise. I'm on > Linux, fairly obviously. > > I have a command w

how to simulate tar filename substitution across piped subprocess.Popen() calls?

2012-11-08 Thread jkn
Hi All i am trying to build up a set of subprocess.Ponen calls to replicate the effect of a horribly long shell command. I'm not clear how I can do one part of this and wonder if anyone can advise. I'm on Linux, fairly obviously. I have a command which (simplified) is a tar -c command piped th