benjia benjia - 1 year ago 103
Python Question

Syntax error in Maya

I wouldn't normally post something so seemingly basic but I've been puzzling over this all afternoon.
Maya is giving me a wonderfully non-specific 'Syntax error' whenever I try to run this code, can anyone see the issue?

import maya.cmds as cmds

def listSelMesh(*args):
cmds.textScrollList("ab_meshList", en=1, ra=1) #CLEAR THE OLD LIST
meshList = cmds.listRelatives(trans, c=1) or [] #GET ANY SHAPES
shapeList =, t=1) #GET ANY MESHES
for trans in shapeList:
cmds.textScrollList("ab_meshList", e=1, a=trans) #APPEND THE CLEARED LIST WITH THE NEW SHAPES

#Create the UI
def createUI(pWindowTitle, pApplyCallback):
windowID = 'ba_skinExport'
#If the UI is already open, delete the pre-existing instance
if cmds.window(windowID, exists=True):

cmds.window(windowID, title=pWindowTitle, sizeable=True, resizeToFitChildren=True)

#Layout the columns in the UI
form = cmds.formLayout()
text1 = cmds.text(label='Selected mesh')
shapeList = cmds.textScrollList("ab_meshList", p=form, h=75)

btn1 = cmds.button(label='Load', command=listSelMesh)
btn2 = cmds.button(label='Export', command=pApplyCallback)
btn3 = cmds.button(label='Import', command=pApplyCallback)
btn4 = cmds.button(label='Cancel', command=cancelCallback, w=85)


cmds.formLayout(form, e=1,
attachForm=((shapeList, "top", 10), (shapeList, "left", 100), (shapeList, "right", 10),
(btn1, "top", 92), (btn1, "left", 100), (btn1, "right", 10),
(text1, "top", 92), (text1, "left", 20),
(btn2, "top", 144), (btn2, "left", 100), (btn2, "right", 100),
(btn3, "top", 144), (btn3, "left", 100), (btn3, "right", 100),
(btn4, "top" 144), (btn4, "left", 10)

createUI('ba_skinExport', applyCallback)

Answer Source

Change this line,(missed a ,)

(btn4, "top" 144)


(btn4, "top", 144)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download