Skip to main content

Bz2file is a Python library for reading and writing bzip2-compressed files.

It contains a drop-in replacement for the file interface in the standard library’s bz2 module, including features from the latest development version of CPython that are not available in older releases.

Bz2file is compatible with CPython 2.6, 2.7, and 3.0 through 3.4, as well as PyPy 2.0.

Features

  • Supports multi-stream files.

  • Can read from or write to any file-like object.

  • Can open files in either text or binary mode.

  • Added methods: peek(), read1(), readinto(), fileno(), readable(), writable(), seekable().

Installation

To install bz2file, run:

$ pip install bz2file

Documentation

The open() function and BZ2File class in this module provide the same features and interface as the ones in the standard library’s bz2 module in the current development version of CPython, documented here.

Version History

0.98: 19 January 2014

  • Added support for the ‘x’ family of modes.

  • Ignore non-bz2 data at the end of a file, rather than raising an exception.

  • Tests now pass on PyPy.

0.95: 08 October 2012

  • Added the open() function.

  • Improved performance when reading in small chunks.

  • Removed the fileobj argument to BZ2File(). To wrap an existing file object, pass it as the first argument (filename).

0.9: 04 February 2012

  • Initial release.

Release files for bz2file 0.98

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bz2file 0.98
File Size Uploaded
bz2file-0.98.tar.gz 11.3 kB Details

Release files / bz2file-0.98.tar.gz

Download URL bz2file-0.98.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
64c1f811e31556ba9931953c8ec7b397488726c63e09a4c67004f43bdd28da88
BLAKE2b-256 checksum
How to use checksums
6139122222b5e85cd41c391b68a99ee296584b2a2d1d233e7ee32b4532384f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.98 This release

1 release file

0.95

1 release file

0.9

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page