![]() | Stand-alone programs can be run as
failure = os.system(command) # or import commands failure, output = commands.getstatusoutput(command) |
![]() | output contains the output of command that in case of os.system will be printed in the terminal window |
![]() | failure is 0 (false) for a successful run of command |
![]() | Our use:
cmd = 'oscillator < %s.i' % case # command to run import commands failure, output = commands.getstatusoutput(cmd) if failure: print 'running the oscillator code failed' print output sys.exit(1) |