def __init__(self, filename, mode='r', pwd=None):
        """Load RAR archive file with mode read only "r"."""
        self.filename = filename
        mode = constants.RAR_OM_LIST_INCSPLIT

        archive = unrarlib.RAROpenArchiveDataEx(filename, mode=mode)
        handle = self._open(archive)

        # assert(archive.OpenResult == constants.SUCCESS)
        self.pwd = pwd
        if self.pwd is not None:
            unrarlib.RARSetPassword(handle, b(self.pwd))
        self.filelist = []
        self.NameToInfo = {}
        if archive.CmtState == constants.RAR_COMMENTS_SUCCESS:
            self.comment = archive.CmtBuf.value
        else:
            self.comment = None
        self._load_metadata(handle)
        self._close(handle)
def __init__ ( self , filename , mode = 'r' , pwd = None ) : self . filename = filename mode = constants . RAR_OM_LIST_INCSPLIT archive = unrarlib . RAROpenArchiveDataEx ( filename , mode = mode ) handle = self . _open ( archive ) self . pwd = pwd if self . pwd is not None : unrarlib . RARSetPassword ( handle , b ( self . pwd ) ) self . filelist = [ ] self . NameToInfo = { } if archive . CmtState == constants . RAR_COMMENTS_SUCCESS : self . comment = archive . CmtBuf . value else : self . comment = None self . _load_metadata ( handle ) self . _close ( handle )
Load RAR archive file with mode read only "r".