I have a python script that searches through a directory, and if any files were recently modified, it executes a command to run our modeling software along with another python script and generate a report. I have the report running currently, and I want to add on a section that if the report generation for some reason was aborted (the software didn't open, there was some error, etc), I want to know and send an email out stating that the run did not complete. Currently I have this below, but I realized that it returns zero since running the actual command worked, even if the report was not generated.
ansa_call = "ansa_15.1.0 -nogui -exec load_script:/path/SubstructureSummary.py -exec 'SubstructureSummary (\""+path+"\")'" print ansa_call ret = os.system(ansa_call) print ret if ret != 0: print 'sending email'
I have injected an error into the secondary script 'SubstructureSummary.py' so that it will be forced to err. How do I grab a return value that shows the incomplete run?
Thank you!!