On Wed, Sep 29, 2010 at 5:59 PM, Antoine Pitrou <solip...@pitrou.net> wrote: > Le mercredi 29 septembre 2010 à 17:41 -0400, Chris Bergstresser a > écrit : >> On Wed, Sep 29, 2010 at 5:23 PM, Antoine Pitrou <solip...@pitrou.net> wrote: >> > Anyway, the obvious way to write line-by-line to a bz2 file is to use >> > the BZ2File class! >> >> The BZ2File class does not allow you to open a file for appending. >> Using the incremental encoder does work, > > In what sense? Do you mean it adds a new bz2 stream at the end of the > existing file?
Yes. If you open an existing bz2 file for appending and use the incremental encoder to encode the data you write to it, you end up with a single file containing two separate bz2 compressed blocks of data. The bunzip2 program handles multiple streams in a single file correctly, and there's a bug open (complete with working patch) in the Python tracker to handle them as well. -- Chris _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com