Python Script conflict... I'm not sure what is going on

Hey guys. I’ve recently built two scripts that work on their own, however there is a really strange issue i’m running into, when I run one script then the other.
using Maya 2015

# Error: Error when calling the metaclass bases
#     unicode() argument 2 must be string, not tuple
# Traceback (most recent call last):
#   File "<maya console>", line 3, in <module>
# TypeError: Error when calling the metaclass bases
#     unicode() argument 2 must be string, not tuple # 

Both scripts are fairly straitforward, however the main issue is that one uses class XXXXX(object),
and thats what seems to be triggering the error. after running the first script.

import maya.cmds as cmds

def mirrorTranslateRotate(controlList):
    Ctrltranslate = cmds.getAttr(controlList + '.translate')
    CtrltranslateMulti = cmds.getAttr(controlList + '.translateMulti')
    Ctrlrotate = cmds.getAttr(controlList + '.rotate')
    CtrlRotateeMulti = cmds.getAttr(controlList + '.rotationMulti')
    CtrltranslateFormatted = [a*b for a,b in zip(Ctrltranslate[0],CtrltranslateMulti[0])]
    CtrlRotateFormatted = [a*b for a,b in zip(Ctrlrotate[0],CtrlRotateeMulti[0])]

    return [CtrltranslateFormatted, CtrlRotateFormatted]
 
def MirrorselectedObjects(firstControl, secondControl = ""):
    axis = ['X','Y','Z']
    if secondControl != "":
        firstControlAttr = mirrorTranslateRotate(firstControl)
        print firstControlAttr
        secondControlAttr = mirrorTranslateRotate(secondControl)
        print secondControlAttr
        listObjectNumerator = 0
        for axi in axis:
            cmds.setAttr( firstControl + ".translate" + axi, secondControlAttr[0][listObjectNumerator])
            cmds.setAttr( firstControl + ".rotate" + axi, secondControlAttr[1][listObjectNumerator])
            cmds.setAttr( secondControl + ".translate" + axi, firstControlAttr[0][listObjectNumerator])
            cmds.setAttr( secondControl + ".rotate" + axi, firstControlAttr[1][listObjectNumerator])
            listObjectNumerator+=1
    elif firstControl[0] == "R":
        Lside = list(firstControl)
        Lside[0] = 'L'
        secondControl = "".join(Lside)
        firstControlAttr = mirrorTranslateRotate(firstControl)
        secondControlAttr = mirrorTranslateRotate(secondControl)
        listObjectNumerator = 0
        for axi in axis:
            cmds.setAttr( firstControl + ".translate" + axi, secondControlAttr[0][listObjectNumerator])
            cmds.setAttr( firstControl + ".rotate" + axi, secondControlAttr[1][listObjectNumerator])
            cmds.setAttr( secondControl + ".translate" + axi, firstControlAttr[0][listObjectNumerator])
            cmds.setAttr( secondControl + ".rotate" + axi, firstControlAttr[1][listObjectNumerator])
            listObjectNumerator+=1
    elif firstControl[0] == "L":
        Rside = list(firstControl)
        Rside[0] = 'R'
        secondControl = "".join(Rside)
        firstControlAttr = mirrorTranslateRotate(firstControl)
        secondControlAttr = mirrorTranslateRotate(secondControl)
        listObjectNumerator = 0
        for axi in axis:
            cmds.setAttr( firstControl + ".translate" + axi, secondControlAttr[0][listObjectNumerator])
            cmds.setAttr( firstControl + ".rotate" + axi, secondControlAttr[1][listObjectNumerator])
            cmds.setAttr( secondControl + ".translate" + axi, firstControlAttr[0][listObjectNumerator])
            cmds.setAttr( secondControl + ".rotate" + axi, firstControlAttr[1][listObjectNumerator])
            listObjectNumerator+=1
                        
MirrorMovement = cmds.ls (sl=True)

for object in MirrorMovement:
    MirrorselectedObjects(object)

Not too sure what is going on, any help would be appreciated. Thanks!

Solved… don’t name things object

1 Like