>>>>> Scott David Daniels <scott.dani...@acm.org> (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: >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. 1) with gzip... is not supported in Python < 3.1 2) for line in iter(proc.stdout), i.e. no second argument. 3) dest <==> f should be the same identifier. Lesson: if you post code either: - test it and copy verbatim from your test, or - write a disclaimer -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list