[Tutor] commands.getoutput equivalent in subprocess

Pete O'Connell pedrooconnell at gmail.com
Sun Mar 18 12:19:58 CET 2012


Hello I print a lot of values at work using grep and need to be
constantly opening a shell window to do this (rather than staying
within my main program which is Nuke by the Foundry). Is there a
simple equilavent to commands.getoutput that is more up to date (I
would assume within the subprocess module)? It sounds like the
commands module will be phased out soonish. I am using Python 2.6

Here is the kind of thing I would like to do in subprocess

import commands
output = commands.getoutput("echo Hello World!")
print output

Thanks
Pete


More information about the Tutor mailing list