From: Adam T. <ate...@gm...> - 2012-02-25 22:51:54
|
Hi all, When testing recent changes to a parser, I've always wanted a way to just call 'python parser.py filename' to see if it works without resorting to another python script and/or installing and running ccget. I figured this could be handled in the main function, which I've modified for the gamessparser: -- if __name__ == "__main__": import doctest, gamessparser, sys if len(sys.argv) == 1: doctest.testmod(gamessparser, verbose=False) if len(sys.argv) >= 2: parser = gamessparser.GAMESS(sys.argv[1]) data = parser.parse() if len(sys.argv) > 2: for i in range(len(sys.argv[2:])): if hasattr(data, sys.argv[2 + i]): print getattr(data, sys.argv[2 + i]) -- Does this seem reasonable? Should it be added to the other parsers? Adam |