Coding issue

Coding issue

rpark7J3CJN
Contributor Contributor
398 Views
1 Reply
Message 1 of 2

Coding issue

rpark7J3CJN
Contributor
Contributor

# SyntaxError: invalid syntax #
import math as m
cmds.file(new=True,force=True)

#checkLIST
#Get Window n functionality first

class CupCakeFactory(object):
def __init__(self):
self.winName = "CupCake Maker"
self.createMaker()

def createMaker(self):
if cmds.window(self.winName, exists=True):
cmds.deleteUI(self.winName)
cmds.window(self.winName)
cmds.frameLayout( label='Master',collapsable=True)
cmds.scrollLayout( 'scrollLayout')
cmds.columnLayout(adjustableColumn=True)

def self.ProductionUI = cmds.frameLayout(label='Make CupCakes',collapsable=True)
# Error: invalid syntax
# File "<maya console>", line 21
# def self.ProductionUI = cmds.frameLayout(label='Make CupCakes',collapsable=True)
# ^
# SyntaxError: invalid syntax #

 

I keep getting syntax errors even if I layed out the code correctly. Could anyone care to explain to me where does this syntax error appears from? Also, is there any way to know how to avoid this in the future.

0 Likes
399 Views
1 Reply
Reply (1)
Message 2 of 2

brentmc
Autodesk
Autodesk

Asside from a missing "from maya import cmds" statement at the top of the script it looks like you are missing the method name in your last def statement.

e.g.

def someMethod(self):
    self.ProductionUI = cmds.frameLayout(label='Make CupCakes',collapsable=True)
Brent McPherson
Principle Engineer