(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 mode not in ("r", "w", "x"):
            raise ValueError("mode must be 'r', 'w' or 'x'")

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

        fileobj = BZ2File(fileobj or name, mode, compresslevel=compresslevel)

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