def parseFile( self, file_or_filename, parseAll=False ):
try:<EOL><INDENT>file_contents = file_or_filename.read()<EOL><DEDENT>except AttributeError:<EOL><INDENT>with open(file_or_filename, "<STR_LIT:r>") as f:<EOL><INDENT>file_contents = f.read()<EOL><DEDENT><DEDENT>try:<EOL><INDENT>return self.parseString(file_contents, parseAll)<EOL><DEDENT>except ParseBaseException as exc:<EOL><INDENT>if ParserElement.verbose_stacktrace:<EOL><INDENT>raise<EOL><DEDENT>else:<EOL><INDENT>raise exc<EOL><DEDENT><DEDENT>
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.