Pymel - can't create a string attribute

1,984 views
Skip to first unread message

Chad_Fox

unread,
Jun 8, 2011, 2:36:47 PM6/8/11
to python_inside_maya

Hi all,

I'm trying to create a string attr, but im getting and error saying
the type specified is unknown. The pymel docs say otherwise.

sel = pym.selected()
pym.addAttr(sel[0], longName="ieCacheType", at="string" )

# Error: RuntimeError: Type specified for new attribute is unknown. #

Any thoughts on why?
Thanks!

Ed Caspersen

unread,
Jun 8, 2011, 3:01:51 PM6/8/11
to python_in...@googlegroups.com
try using dataType (dt) and not attributeType (at):

pym.addAttr(sel[0], longName="ieCacheType", dt="string" )


Since your selected node has methods you could just call straight off the node itself

sel[0].addAttr("ieCacheType", dt="string")






--

Ed Caspersen

Chad_Fox

unread,
Jun 8, 2011, 3:20:47 PM6/8/11
to python_inside_maya
Foiled by a single letter, thank you for noticing that.

and thanks for the suggestion to use a method. I'll use this approach
instead.

Cheers,

Chad
Reply all
Reply to author
Forward
0 new messages