(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs)
return t
Open bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
Open bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
Open bzip2 compressed tar archive name for reading or writing . Appending is not allowed .
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
        """Open bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        """
        if len(mode) > 1 or mode not in "rw":
            raise ValueError("mode must be 'r' or 'w'.")

        try:
            import bz2
        except ImportError:
            raise CompressionError("bz2 module is not available")

        if fileobj is not None:
            fileobj = _BZ2Proxy(fileobj, mode)
        else:
            fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel)

        try:
            t = cls.taropen(name, mode, fileobj, **kwargs)
        except (IOError, EOFError):
            fileobj.close()
            raise ReadError("not a bzip2 file")
        t._extfileobj = False
        return t
def bz2open ( cls , name , mode = "r" , fileobj = None , compresslevel = 9 , * * kwargs ) : if len ( mode ) > 1 or mode not in "rw" : raise ValueError ( "mode must be 'r' or 'w'." ) try : import bz2 except ImportError : raise CompressionError ( "bz2 module is not available" ) if fileobj is not None : fileobj = _BZ2Proxy ( fileobj , mode ) else : fileobj = bz2 . BZ2File ( name , mode , compresslevel = compresslevel ) try : t = cls . taropen ( name , mode , fileobj , * * kwargs ) except ( IOError , EOFError ) : fileobj . close ( ) raise ReadError ( "not a bzip2 file" ) t . _extfileobj = False return t