Skip to content

Python FAQ

Ian Keough edited this page Jun 17, 2015 · 2 revisions

Q: I get the error Type error. Expected Array[float], got list. when attempting to put a Dynamo list into python.
A: If you receive this error, you need to make a typed array in Python and load it with the values from the incoming list. You can do this like so:

import clr

# Import System to get access to array creation methods.
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

curve = IN[0]
params = IN[1]

# Create a typed array.
paramsSingle = System.Array.CreateInstance(float, len(params))

# Load the values into your typed array.
for i in range(0,len(params)):
	paramsSingle[i] = params[i]

# Use the typed array instead of the list.
OUT = curve.ParameterSplit(paramsSingle)

Releases

Roadmap

How To

Dynamo Internals

Contributing

Python3 Upgrade Work

Libraries

FAQs

API and Dynamo Nodes

Clone this wiki locally