mayapython-standalone

mayapy/maya.standalone error: No object matches name: .aiTranslator


When I run this in mayapy:

import maya.standalone
maya.standalone.initialize()
import maya.cmds as cmds
cmds.file("/Users/Desktop/test.ma", open=True, force=True)

Then I get this error:

RuntimeError: file: /Users/Desktop/dad.ma line 26: The camera 'perspShape' has no '.aiTranslator' attribute.
file: /Users/Desktop/test.ma line 26: setAttr: No object matches name: .aiTranslator
file: /Users/Desktop/test.ma line 43: The camera 'topShape' has no '.aiTranslator' attribute.
file: /Users/Desktop/test.ma line 43: setAttr: No object matches name: .aiTranslator
file: /Users/Desktop/test.ma line 59: The camera 'frontShape' has no '.aiTranslator' attribute.
file: /Users/Desktop/test.ma line 59: setAttr: No object matches name: .aiTranslator
file: /Users/Desktop/test.ma line 76: The camera 'sideShape' has no '.aiTranslator' attribute.
file: /Users/Desktop/test.ma line 76: setAttr: No object matches name: .aiTranslator
file: /Users/Desktop/test.ma line 90: The mesh 'pSphereShape1' has no '.aiTranslator' attribute.
file: /Users/Desktop/test.ma line 90: setAttr: No object matches name: .aiTranslator
Error reading file.
Error reading file.

But when I run this in maya:

import maya.cmds as cmds
cmds.file("/Users/Desktop/test.ma", open=True, force=True)

Then executes just fine.

test.ma is just a new scene with one object in, nothing fancy. For some reason, running this trough the mayapy/maya.standalone I get this error


Solution

  • You probably need to check if mtoa is loaded or not. If not loaded then load it before opening the file.

    import maya.standalone
    maya.standalone.initialize()
    import maya.cmds as cmds
    if  not cmds.pluginInfo("mtoa.so", q=True, loaded=True):
         cmds.loadPlugin("mtoa.so")
    cmds.file("/Users/Desktop/test.ma", open=True, force=True)