Compressing output via pipes

Jeremy Bowers jerf at jerf.org
Fri Nov 28 22:36:54 EST 2003


On Wed, 26 Nov 2003 13:49:49 -0700, Orr, Steve wrote:

> I want to compress the *.dmp dump file on the fly without having to
> compress an intervening file. I know I need to do something with pipes
> and/or os.dup2() but I'm struggling. Has anyone done something like this?

Are you sure you need pipes? 

http://www.python.org/doc/current/lib/module-zlib.html
http://www.python.org/doc/current/lib/module-gzip.html

You probably should use os.popen2 to read the output directly and stuff it
into a GzipFile instead of letting the operating system write the file,
but I'm not 100% certain I understand what you're looking for.




More information about the Python-list mailing list