从Python调用.NET库

2024-06-26 03:41:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用一个.NET库来用Python控制电机控制器(8742,新焦点)。我使用python2.7和Anaconda发行版。 在.dll文件中有一个构造函数,我必须先调用它。从文档中我有关于构造函数的这些信息。在

/// <summary>
/// Constructor.
/// </summary>
public CmdLib8742 ()
/// <summary>
/// Constructor.
/// </summary>
/// <param name="logging">True to request logging, otherwise false.</param>
/// <param name="msecDelayForDiscovery">The number of milliseconds to wait for devices to be discovered.</param>
/// <param name="deviceKey">The first device in the list of open instruments (null = none found).</param>///
public CmdLib8742 (bool logging, int msecDelayForDiscovery, ref string deviceKey) 

我的Python代码如下所示:

^{pr2}$

如果我在控制台上写

Picomotor()

我得到错误“AttributeError:function'CmdLib8742'not found”

如何正确调用构造函数并使用.dll文件中的函数(示例中未显示)?在

非常感谢你的帮助。在

附言:前面的答案对我没有帮助。在

Calling a C# library from python


Tags: 文件ofthetonameparamloggingpublic