Hello, I’m trying to make an exception to check for errors and the try works fine but the except isnt checking the error and was wondering if I typed it incorrectly
The Code described above:
def assignColor_callback(self, *args):
colorValue = cmds.colorIndexSliderGrp(self.UIElements['colorSlider'], q=True, value=True)
selection = cmds.ls(sl=True)
shapeNode = cmds.listRelatives(shapes=True)
for selected in selection:
for shape in shapeNode:
try:
cmds.setAttr("{0}.overrideEnabled".format(shape), True)
except TypeError:
logging.error(selected + " Needs to have a shape Node in order to change the color.")
I even tried except: just by itself to detect any error and that didnt even work so I’m wondering if I did something wrong?
the Error that is returned looks like this:
# Error: 'NoneType' object is not iterable
# Traceback (most recent call last):
# File "E:/3D/maya/2012-x64/scripts\fa_RiggingTools.py", line 475, in assignColor_callback
# for shape in shapeNode:
# TypeError: 'NoneType' object is not iterable #