Skip to content

Instantly share code, notes, and snippets.

@cgibson
Created May 27, 2011 18:55
Show Gist options
  • Save cgibson/995905 to your computer and use it in GitHub Desktop.
Save cgibson/995905 to your computer and use it in GitHub Desktop.
Run Duco Render Process
t0 = time.time()
p = subprocess.Popen([cmdStr], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.wait()
t1 = time.time()
t = t1 - t0
os.symlink("%s/%s" % (job_dir, imgFile), "%s/%s.tga" % (images_folder, job_name))
stdout = p.stdout
stderr = p.stderr
# Write output to std.out
f = file('std.out', 'w')
f.write(stdout.read())
f.close()
# If necessary, write error output to std.err
stderrstr = stderr.read()
if( len(stderrstr) > 0 ):
f = file('std.err', 'w')
f.write(stderrstr)
f.close()
# Write final thoughts
f = file('results.log', 'w')
f.write("Command: %s\n" % cmdStr)
f.write("Run Time: %.2f\n" % t)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment