Issue combining gzip and subprocess

Scott David Daniels Scott.Daniels at Acm.Org
Fri Jul 24 01:20:27 EDT 2009


Piet van Oostrum wrote:
>>>>>> Scott David Daniels <Scott.Daniels at Acm.Org> (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.
> 
> 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

Totally chagrined and embarassed.
Chastisement absorbed and acknowledged.

--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-list mailing list