Missing attribute error after duplicating

25 views
Skip to first unread message

Herbert Agudera

unread,
Jun 22, 2023, 6:19:29 AM6/22/23
to Python Programming for Autodesk Maya
Hello everyone.

I am fairly new at scripting in maya/python. A few days ago i watched some youtube videos about python scripting for maya artists. watched arvids video about making a script to convert maya shaders to arnold shaders.

anyway, here is what i am having trouble with

aiRampHi_mask = pmc.duplicate("aiRamp_Hi", ic = True, ic = True, name = "aiRampHi_mask")
aiRampHi_mask.outColorR >> aiLayer.mix4

the error
# Error: 'list' object has no attribute 'outColorR'
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# AttributeError: 'list' object has no attribute 'outColorR' #

I can connect the two manually but i cant using the script. what is missing here?

Thanks!

Justin Israel

unread,
Jun 22, 2023, 6:25:58 AM6/22/23
to python_in...@googlegroups.com


On Thu, 22 Jun 2023, 10:19 pm Herbert Agudera, <herbert...@gmail.com> wrote:
Hello everyone.

I am fairly new at scripting in maya/python. A few days ago i watched some youtube videos about python scripting for maya artists. watched arvids video about making a script to convert maya shaders to arnold shaders.

anyway, here is what i am having trouble with

aiRampHi_mask = pmc.duplicate("aiRamp_Hi", ic = True, ic = True, name = "aiRampHi_mask")
aiRampHi_mask.outColorR >> aiLayer.mix4

the error
# Error: 'list' object has no attribute 'outColorR'
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# AttributeError: 'list' object has no attribute 'outColorR' #

The return value of duplicate() is a list of the duplicated objects. So the error is telling you that you are attempting to access a field that does not exist on a list. 
To access the first item of a list:
    item = aiRampHi_mask[0] 



I can connect the two manually but i cant using the script. what is missing here?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8578ba87-a1ac-49ea-8e08-d214632b0a21n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages