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