Creation of a list : TypeError: expected string for parameter 'text' but got 'list'

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 re

SystemList = 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.

I think the line number 9 should be SystemList = IN[0]

1 Like

Oh my, it was even more a rookie mistake than I thought !
Thank you EdsonMatt, I should rename “IN” to “IN[0]”.
As the python script start automatically with “dataEnteringNode = IN”, I didn’t realize that it wasn’t the name of the input on the node.
Dynamo solution

Thanks again,
Gerald.