pymel.util.executableOutput

static util.executableOutput(exeAndArgs, convertNewlines=True, stripTrailingNewline=True, returnCode=False, input=None, **kwargs)

Will return the text output of running the given executable with the given arguments.

This is just a convenience wrapper for subprocess.Popen, so the exeAndArgs argment should have the same format as the first argument to Popen: ie, either a single string giving the executable, or a list where the first element is the executable and the rest are arguments.

Parameters :
convertNewlines : bool

if True, will replace os-specific newlines (ie, rn on Windows) with the standard n newline

stripTrailingNewline : bool

if True, and the output from the executable contains a final newline, it is removed from the return value Note: the newline that is stripped is the one given by os.linesep, not n

returnCode : bool

if True, the return will be a tuple, (output, returnCode)

input : string

if non-none, a string that will be sent to the stdin of the executable

kwargs are passed onto subprocess.Popen

Note that if the keyword arg ‘stdout’ is supplied (and is something other than subprocess.PIPE), then the return will be empty - you must check the file object supplied as the stdout yourself.

Also, ‘stderr’ is given the default value of subprocess.STDOUT, so that the return will be the combined output of stdout and stderr.

Finally, since maya’s python build doesn’t support universal_newlines, this is always set to False - however, set convertNewlines to True for an equivalent result.

Previous topic

pymel.util.escape

Next topic

pymel.util.exp

Core

Core Modules

Other Modules

This Page