问题
While creating and debugging scripts, I generate lots of feedback for myself, but if I don't clear the Script Editor, I can get confused about which attempt the feedback I'm looking at came from.
Is there a way (preferably with PyMEL, but MEL is ok) to clear the Script Editor History?
回答1:
Try:
cmds.scriptEditorInfo(ch=True)
Or (PyMEL version):
import pymel.core as pm
pm.scriptEditorInfo(clearHistory=True)
You should also take a look at python's built-in logging module. It allows you to define logging formatters which include the file name and line number where the log message was generated so you can see precisely where things came from.
来源:https://stackoverflow.com/questions/35313339/how-can-i-clear-the-maya-script-editor-programatically