Re: Issue combining gzip and subprocess

2009-07-23 Thread Scott David Daniels
Piet van Oostrum wrote: Scott David Daniels (SDD) schreef: ... SDD> Or even: SDD> proc = subprocess.Popen(['ls','-la'], stdout=subprocess.PIPE) SDD> with gzip.open(filename, 'w') as dest: SDD> for line in iter(proc.stdout, ''): SDD> f.write(line) If it would work.

Re: Issue combining gzip and subprocess

2009-07-22 Thread Piet van Oostrum
> Scott David Daniels (SDD) schreef: >SDD> Piet van Oostrum wrote: >>> ... >>> f = gzip.open(filename, 'w') >>> proc = subprocess.Popen(['ls','-la'], stdout=subprocess.PIPE) >>> while True: >>> line = proc.stdout.readline() >>> if not line: break >>> f.write(line) >>> f.close() >SDD> Or even

Re: Issue combining gzip and subprocess

2009-07-22 Thread Scott David Daniels
Piet van Oostrum wrote: ... f = gzip.open(filename, 'w') proc = subprocess.Popen(['ls','-la'], stdout=subprocess.PIPE) while True: line = proc.stdout.readline() if not line: break f.write(line) f.close() Or even: proc = subprocess.Popen(['ls','-la'], stdout=subprocess.PIPE)

Re: Issue combining gzip and subprocess

2009-07-21 Thread Piet van Oostrum
> Iwan Vosloo (IV) wrote: >IV> Hi there, >IV> We tried to gzip the output of a shell command, but this results in a >IV> strange error: the resulting file seems to be the concatenation of the >IV> plaintext file with the zipped content. >IV> For example: >IV> f = gzip.open(filename, 'w') >I