Hi there,

We tried to gzip the output of a shell command, but this results in a
strange error: the resulting file seems to be the concatenation of the
plaintext file with the zipped content.

For example:

f = gzip.open(filename, 'w')
subprocess.check_call(['ls','-la'], stdout=f)
f.close()

Using a normal file works as expected, but a GzipFile results in a file
containing what looks like the unzipped data, followed by the zipped
data.

I suspect this may have something to do with limitations of GzipFile
such as it not implementing truncate().

Does anyone have an explanation / can you suggest a nice solution for
doing what we are trying to do?

Regards
- Iwan

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to