【问题标题】:Python script that runs from MEL Command从 MEL 命令运行的 Python 脚本
【发布时间】:2017-06-22 22:12:51
【问题描述】:

我编写了这个 Python 脚本,当我使用 MEL 命令时应该运行它。 之前在我的学校电脑上测试它时它工作过。但是现在好像不行了,不知道是不是上次改了,我也看不出来。

当我现在运行它时,它说它找不到模块的路径。这是正确的错误行。

Error: ImportError: No module named inlupp3

我有脚本:D:\Autodesk\maya2012\script

这是我的 Python 脚本:

import maya.cmds as mc
import math
import random as rdm
import inlupp3 as in3
reload(mm)

def Spiral():
    currentFrame = mc.currentTime( q = True )
    startFr =  mc.currentTime( 1 )
    endFr = 200
    qtyPlap = 5
    aspPlap = 15
    rad = 10
    origObj = "pCube1"

if currentFrame % 10 == 0:
   mm.clickOK() 

rdmX = rdm.uniform( -0.8, 0.8 )
rdmY = rdm.uniform( -0.8, 0.8 )
rdmZ = rdm.uniform( -0.8, 0.8 )
mc.move( rdmX, rdmY, rdmZ, "pCube1", relative = True, localSpace = True )

这是我的 MEL 命令:

python( "import inlupp3 as inl3" ) ;
python( "reload( mm )" ) ;
python( "inl3.clickOK( 1, 200, 5, 15, 10, 'pCube1' )" ) ;

【问题讨论】:

    标签: python if-statement maya mel


    【解决方案1】:

    首先将您的脚本放在正确的文件路径中,该路径位于您的 C:\Users[username]\Documents\maya\scripts

    下一步如果您提供的第一个 sn-p 具有 import inlupp3 as in3 您不能将其导入到自身

    你的 reload(mm) 我不确定这是指什么,但如果你试图重新加载你需要的模块,那么它应该是 reload(inl3)

    你也有 in3 作为顶部 sn-p 中的模块和第二个 sn-p 中的 inl3

    我还建议在您的文件名中取出数字

    【讨论】:

    • 感谢您的回答。在你回答之前,我想出了你提到的一些东西。我现在遇到的问题是“in3.clickOk”出现错误。它贴在这里:# Error: AttributeError: 'module' object has no attribute 'clickOK' #
    • 这意味着您尝试调用的函数或属性不存在检查名称和大写字母
    猜你喜欢
    • 2014-01-20
    • 1970-01-01
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-17
    • 2019-02-08
    • 1970-01-01
    • 2016-12-15
    相关资源
    最近更新 更多