【发布时间】:2018-08-18 04:48:20
【问题描述】:
我正在使用win32com.client 从 VB.Net 开发的自定义 COM 对象中读取数据。
通过以下代码,我可以读取字符串结果
>>> import win32com.client
>>> cstApp = win32com.client.Dispatch("CustomLib.CSTApp")
>>> string = cstApp.GiveMeTestString()
>>> print(type(string))
<class 'str'>
>>> print("Test String: {0}".format(string))
Test String: Well done! I come from COM Object
我现在有一个方法可以作为结果给出一个 VB.Net 字典类型,但是当我尝试从我的 python 脚本中读取它时,我得到了一个 PyIUknown 类型并且我无法读取它的值
>>> username = 'artur'
>>> resultset = cstApp.OpenTaskforUser(username)
>>> print(type(resultset))
<class 'PyIUnknown'>
>>> print(resultset)
<PyIUnknown at 0x0000003C47ABAC30 with obj at 0x0000003C47EAFF18>
如何读取它的数据?
否则,我需要在 VB.Net 中使用哪种类型才能读取包含来自 win32com 的字典的 Python 列表?
感谢您的帮助。
【问题讨论】:
标签: python vb.net com pywin32 win32com