我正在尝试创建一个简单的Python脚本,它将从Maya中调用MEL脚本来创建立方体。耶!应该是相当直截了当,虽然我可能得到了源文件的语法错误。在
以下是我所拥有的:
在runMEL.pyPython文件: 进口玛雅.mel作为mel
def runMEL():
print ("Running MEL from Python!")
mel.eval('"source D:\Maya_Python\myMELScript.mel;"') # source of the file
mel.eval("myMELScript;") #name of the function
runMEL() # call the function above
以及MEL脚本myMELScript.mel在
^{pr2}$我从控制台得到以下信息:
Running MEL from Python!
// Error: "source D:\Maya_Python\myMELScript.mel;"; //
// Error: Line 1.40: Syntax error //
# Error: RuntimeError: file <maya console> line 5: Error occurred during execution of MEL script
Line 1.40: Syntax error #
你差一点就搞定了,你必须把路径作为一个字符串传递,然后逃出它。此外,mel对前斜杠
/
和后斜杠\
很挑剔,它期望/
应该这样做:
注意:通常在python中,您可以编写路径以及
^{pr2}$但是梅尔不够聪明,所以它会逃过逃跑的标志:D
相关问题 更多 >
编程相关推荐