pymel.internal.shellOutput

shellOutput(shellCommand, convertNewlines=True, stripTrailingNewline=True, **kwargs)

Will return the text output of running a given shell command.

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

With default arguments, behaves like commands.getoutput(shellCommand), except it works on windows as well.

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.internal.setupFormatting

Next topic

pymel.internal.shortName

Core

Core Modules

Other Modules

This Page