def open(self, mode='<STR_LIT:a>', **kwargs):
tables = _tables()<EOL>if self._mode != mode:<EOL><INDENT>if self._mode in ['<STR_LIT:a>', '<STR_LIT:w>'] and mode in ['<STR_LIT:r>', '<STR_LIT>']:<EOL><INDENT>pass<EOL><DEDENT>elif mode in ['<STR_LIT:w>']:<EOL><INDENT>if self.is_open:<EOL><INDENT>raise PossibleDataLossError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(self._path, self._mode)<EOL>)<EOL><DEDENT><DEDENT>self._mode = mode<EOL><DEDENT>if self.is_open:<EOL><INDENT>self.close()<EOL><DEDENT>if self._complevel and self._complevel > <NUM_LIT:0>:<EOL><INDENT>self._filters = _tables().Filters(self._complevel, self._complib,<EOL>fletcher32=self._fletcher32)<EOL><DEDENT>try:<EOL><INDENT>self._handle = tables.open_file(self._path, self._mode, **kwargs)<EOL><DEDENT>except (IOError) as e:  <EOL><INDENT>if '<STR_LIT>' in str(e):<EOL><INDENT>print(<EOL>'<STR_LIT>'.format(path=self._path))<EOL>self._handle = tables.open_file(self._path, '<STR_LIT:r>', **kwargs)<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>except (ValueError) as e:<EOL><INDENT>if '<STR_LIT>' in str(e):<EOL><INDENT>e = ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(version=tables.__version__,<EOL>hdf_version=tables.get_hdf5_version()))<EOL><DEDENT>raise e<EOL><DEDENT>except (Exception) as e:<EOL><INDENT>if self._mode == '<STR_LIT:r>' and '<STR_LIT>' in str(e):<EOL><INDENT>raise IOError(str(e))<EOL><DEDENT>raise<EOL><DEDENT>
Open the file in the specified mode

Parameters
----------
mode : {'a', 'w', 'r', 'r+'}, default 'a'
    See HDFStore docstring or tables.open_file for info about modes