将VBA转换为Python

2024-05-16 02:41:25 发布

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

我有一个应用程序,我需要从Python自动化。在文档中,是在VBA中执行此操作的示例:

Dim eASEE As Object
Dim CDMDomain As Object

 Set eASEE = CreateObject("Nestor.Application")
 If Not eASEE.IsConnected Then
     eASEE.Connect "User", "Password", "Domain", "Server"
 End If

我试着把它转换成Python:

^{pr2}$

到目前为止,它是有效的。但如果我打电话:

eASEE.Connect("User", "Password", "Domain", "Server")

我得到以下错误:

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "<COMObject Nestor.Application>", line 3, in Connect
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147467259), None)

你知道原因是什么吗?我该试试什么?谢谢您。在


Tags: noneifobjectserverapplicationdomainasconnect