Hello everybody,
I’m Gerald and i’m working on a small python script to avoid to work with a lot of nodes, but i am facing something i guess is silly which is the title error : TypeError: expected string for parameter ‘text’ but got ‘list’
I have to set in a parameter a text which is linked
to the system type or service type of an HVAC object.
I can obtain a list of those system types and I want to compare it with a dictionary in a python script.
If I write my own list in the python script (like TestList = [CVC_AN, CFA_AP]), everything works, I can read it and append to my out list the value I need.
But when I use the list I previously obtain with buildin nodes, i get an error.
import sys
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
import reSystemList = IN
Dico = {
“CFA” : “CFA”,
“CFO” : “CFO”,
“CVC” : “CVC”,
“PLB” : “PLB”,
“PRI” : “PRI”
}Sortie =
for data in SystemList :
if re.compile(“CFA.",re.IGNORECASE).match(data):
Sortie.append(Dico[“CFA”])
elif re.compile("CFO.”,re.IGNORECASE).match(data):
Sortie.append(Dico[“CFO”])
else:
Sortie.append(“ADEF”)OUT = Sortie
Once again, i am pretty sure it’s a newbie problem, but I can’t find something on the web about it.
This dictionary is a small one, but if it works, I have another huge list to exploit.
Thank you all for your help,
Have a nice day.
Gerald.