报错:has no attribute “EnsureDispatch”
报错:typeError :'‘PyIUknow’ object is not callable
如果你在com端接口类型是List,在python端调用时候出现上述问题:
使用数组而非列表:COM更容易处理数组而非.NET的List。考虑更改接口的返回类型为Project[]而不是List。
C#转换方法
List<int> numbers = new List<int> { 1, 2, 3, 4, 5 };
int[] array = numbers.ToArray();
foreach (int number in array)
{
Console.WriteLine(number);
}
接口设计
public Project[] getProjects();