2008年11月16日 星期日

[Python code] Run commands in shell

import commands
cmd = 'programName < %s.i' % case # command to run
failure, output = commands.getstatusoutput(cmd)
if failure:
print 'Running the programName code failed\n%s\n%s' % (cmd, output)
sys.exit(1)

沒有留言: