AttributeError: attribute 'Element' of Namespace# object is read only

excel
python
revit
dynamo

#1

Hello,

I received the error ‘AttributeError: attribute ‘Element’ of Namespace# object is read only’ when running my python node. Does anyone know what the error might be? I’m assuming based on my search it’s something to do with needing to reference an external library. But I’m not sure which one. Here is my code with the line giving error highlighted. Thank you for your help!!!


#2

Hi @alexischerner

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('DSCoreNodes') 
import DSCore
from DSCore import *

elem = IN[0]
col=IN[1];
cc=[]
for i in elem:
	cc.append(i.OverrideColorInView(col))
OUT = cc

#3

Hi @Kulkul Thank you for reply! I need to cycle through a list of different colors. So, for example, if I have 4 wall elements, I need to assign each one a unique color. That’s why I set up my code as I did above. So I want the inputs to be a list of RBG colors, and a list of elements to change. Does that make sense?
This image shows what I want to input for different colors. Thank you