( self, file_or_filename, parseAll=False )
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.
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.
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 .
def parseFile( self, file_or_filename, parseAll=False ):
        """
        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.
        """
        try:
            file_contents = file_or_filename.read()
        except AttributeError:
            with open(file_or_filename, "r") as f:
                file_contents = f.read()
        try:
            return self.parseString(file_contents, parseAll)
        except ParseBaseException as exc:
            if ParserElement.verbose_stacktrace:
                raise
            else:
                # catch and re-raise exception from here, clears out pyparsing internal stack trace
                raise exc
def parseFile ( self , file_or_filename , parseAll = False ) : try : file_contents = file_or_filename . read ( ) except AttributeError : with open ( file_or_filename , "r" ) as f : file_contents = f . read ( ) try : return self . parseString ( file_contents , parseAll ) except ParseBaseException as exc : if ParserElement . verbose_stacktrace : raise else : # catch and re-raise exception from here, clears out pyparsing internal stack trace raise exc