Problème when I create attribute


#1

Hello, I start programming and I have a problem when I create an attribute. I have this error message:
“Found no valid items to add the attribute to”

I searched everywhere, and I came across a lot of scripts that work very well, but none that correspond to what I want. I need an attribute with a small drop-down menu with different proposals, which is visible in the channel box.
For the moment, even with the error message I have an attribute that is created, but with a single entry while I give it a list and not visible in the channel box.
None of the examples I found is in “enum” mode, so I think the problem comes from that.
Can you help me?
thank you in advance

My current code:
def addAttrToLocSwitch(nameSwitch):
entryNum = cmds.intSliderGrp(“LSISgMap”, query=True, value = True)
valueEntryList = “”
for i in range(1,entryNum+1):
valueEntryList += cmds.textFieldGrp( “LSITfgNameInputMap”+str(i), query=True, text=True )+":"
print valueEntryList
cmds.addAttr(nameSwitch,ln=“changeColorMap”, nn =“Change Color Map”, at=“enum”, en=valueEntryList, k=True)

(Sorry if my sentences are weird, I do not speak English very well and I used a translator)