def open(self, _file, target=DEFAULT_TARGET):
<EOL>self.close()<EOL>if type(_file) is FileType:<EOL><INDENT>filename = _file.name<EOL>if islink(filename):<EOL><INDENT>raise BfdException("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>self._ptr = _bfd.fdopenr(filename, target, dup(_file.fileno()))<EOL><DEDENT>except Exception as err:<EOL><INDENT>raise BfdException(<EOL>"<STR_LIT>" % (filename, err))<EOL><DEDENT><DEDENT>elif type(_file) is StringType:<EOL><INDENT>filename = _file<EOL>try:<EOL><INDENT>with open(_file): pass<EOL><DEDENT>except IOError:<EOL><INDENT>raise BfdException("<STR_LIT>" % filename)<EOL><DEDENT>try:<EOL><INDENT>self._ptr = _bfd.openr(filename, target)<EOL><DEDENT>except (TypeError, IOError) as err:<EOL><INDENT>raise BfdException(<EOL>"<STR_LIT>" % (filename, err))<EOL><DEDENT><DEDENT>elif type(_file) is IntType:<EOL><INDENT>self._ptr = _file<EOL><DEDENT>else:<EOL><INDENT>raise BfdException(<EOL>"<STR_LIT>" % _file)<EOL><DEDENT>try:<EOL><INDENT>if _bfd.check_format(self._ptr, BfdFormat.ARCHIVE):<EOL><INDENT>self.file_format = BfdFormat.ARCHIVE<EOL>self.__populate_archive_files()<EOL><DEDENT>else:<EOL><INDENT>if _bfd.check_format(self._ptr, BfdFormat.OBJECT):<EOL><INDENT>self.file_format = BfdFormat.OBJECT<EOL><DEDENT>elif _bfd.check_format(self._ptr, BfdFormat.CORE):<EOL><INDENT>self.file_format = BfdFormat.CORE<EOL><DEDENT>else:<EOL><INDENT>pass<EOL>raise BfdException(_bfd.get_last_error_message())<EOL><DEDENT><DEDENT><DEDENT>except TypeError as err:<EOL><INDENT>raise BfdException(<EOL>"<STR_LIT>" % err)<EOL><DEDENT>if self._ptr is not None:<EOL><INDENT>if self.file_format in [BfdFormat.OBJECT, BfdFormat.CORE]:<EOL><INDENT>self.__populate_sections()<EOL>self.__populate_symbols()<EOL><DEDENT><DEDENT>
Open the existing file for reading.

@param _file : A filename of file descriptor.
@param target: A user-specific BFD target name.

@return : None