首页 > 解决方案 > Pythonnet TypeError:没有方法匹配给定的参数

问题描述

我在C#使用pythonnet.

我已经加载了dll文件,当我调用一个函数时,我收到了 - TypeError: No method matches given arguments for Connect: (<class 'System.UInt64'>, <class 'System.String'>, <class 'System.String'>, <class 'int'>, <class 'System.UInt32'>)

serv = String('121.0.0.1:111')
login = UInt64(1)
empty_string = String(' ')
password = String('password')
time_out = UInt32(1)
cmt = CIMTAdminAPI
pump_mode = cmt.EnPumpModes.PUMP_MODE_MAIL
print(pump_mode)
print(serv)
print(login)
print(password)
print(empty_string)
print(time_out)
connection_serv = cmt.Connect
print(connection_serv)
connection_serv[String, UInt64, String, String, cmt.EnPumpModes, UInt32](serv, login, password, empty_string, pump_mode, time_out)

我尝试过不同的事情要做。但总是收到相同的结果。

这些是我需要提出的价值观

Connect(System.String, UInt64, System.String, System.String, EnPumpModes, UInt32)

控制台的完整输出

4
121.0.0.1:111
1
password
 
1
<unbound method 'Connect'>
Traceback (most recent call last):
  File "C:\Users\anton\PycharmProjects\work_projects\pynet.py", line 26, in <module>
    connection_serv[String, UInt64, String, String, cmt.EnPumpModes, UInt32](serv, login, password, empty_string, pump_mode, time_out)
TypeError: No match found for given type params

标签: pythonpython.net

解决方案


推荐阅读