def main(argv): try: opts, args = getopt.getopt(argv, "hi:l", ["project_file=", "logging"]) except getopt.GetoptError: print("""pyMANGA wrong usage. Type "python main.py -h" for additional help.""") sys.exit(0) for opt, arg in opts: if opt == '-h': print("""pyMANGA arguments: -i,--project_file <path/to/xml/project/file>""") sys.exit() elif opt in ("-i", "--project_file"): project_file = str(arg) elif opt in ("-l", "--logging"): logging.basicConfig( filename='MANGA.log', level=logging.INFO, filemode='w', # overwrite existing log file format='%(asctime)s %(message)s') print('Logging mode\n') try: prj = XMLtoProject(xml_project_file=project_file) except UnboundLocalError: raise UnboundLocalError('Wrong usage of pyMANGA. Type "python' + ' main.py -h" for additional help.') print('Running pyMANGA project ', project_file) time_stepper = TreeDynamicTimeStepping(prj) prj.runProject(time_stepper) print('pyMANGA project ', project_file, ' successfully evaluated.')
def test(self): #Test of MANGA project file and the and the correct calculation of its. try: prj = XMLtoProject(xml_project_file=xmlfile) time_stepper = TreeDynamicTimeStepping(prj) prj.runProject(time_stepper) #Storing failed test for clear evaluation except: self.fail(errors.append(xmlfile))
def main(argv): try: opts, args = getopt.getopt(argv, "hi:", ["project_file="]) except getopt.GetoptError: print("""pyMANGA wrong usage. Type "python main.py -h" for additional help.""") sys.exit(0) for opt, arg in opts: if opt == '-h': print("""pyMANGA arguments: -i,--project_file <path/to/xml/project/file>""") sys.exit() elif opt in ("-i", "--project_file"): project_file = str(arg) try: prj = XMLtoProject(xml_project_file=project_file) except UnboundLocalError: raise UnboundLocalError('Wrong usage of pyMANGA. Type "python' + ' main.py -h" for additional help.') print('Running pyMANGA project ', project_file) time_stepper = TreeDynamicTimeStepping(prj) prj.runProject(time_stepper) print('pyMANGA project ', project_file, ' successfully evaluated.')
def __init__(self, project_file): self.prj = XMLtoProject(xml_project_file=project_file) self.t_step_begin = 0