TypeError: expected List[Line], got list

Hi EveryBody. I’m trying to use the SpaceAnalysis Package inside python. When I try to create a SpaceLattice this error comes:

TypeError: expected List[Line], got list.

input_list[5] is a list of exclusively lines, so I don’t understand it.

Any Ideas??
Thank you very much in advance!

Hi,

you can try the following:

import clr
clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import Line

list_with_lines = List[Line](input_list[5])

This explicitly tells Python that it is a List[Line].

1 Like

it’s worth reading about whats going on here:
https://ironpython.net/documentation/dotnet/dotnet.html#accessing-generic-types

generic types (including generic lists) are a feature of .net/c# - python lists are not the same as the generic list of line the function is expecting… but since ironPython is built on .net you can create a .net List using the syntax above.

2 Likes

Thank you! That was it .