We have some plugins that run as mel commands, and when things go wrong they spew useful info to the script editor, but return 0. How do I capture the script editor spew (not the return value) of a mel command, using python?
import pymel.core as pm
mel_cmd= 'print("hello world\\n");'
result=pm.mel.eval(mel_cmd) # no this is just the return value
print "the output of mel '{}' is: '{}'".format(mel_cmd, result)
#script editor output:
#hello world
#the output of mel 'print("hello world\n");' is: 'None'