我试图从ssh运行以下简单的pyhton脚本:
# -*- coding: utf-8 -*-
import comtypes.client
acad = comtypes.client.CreateObject("AutoCAD.Application")
acad.Visible = True
这可以从本地计算机上正常工作,但不能通过ssh工作,我收到错误:
Traceback (most recent call last):
File "C:/Ab*******/comtypetest.py", line 6, in <module>
acad = comtypes.client.CreateObject("AutoCAD.Application")
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 227, in CreateObject
clsid = comtypes.GUID.from_progid(progid)
File "C:\Python27\lib\site-packages\comtypes\GUID.py", line 78, in from_progid
_CLSIDFromProgID(unicode(progid), byref(inst))
File "_ctypes/callproc.c", line 945, in GetResult
WindowsError: [Error -2147221005] Invalid class string
创建InternetExplorer.Application不是从ssh开始工作,而是Windows不能看到它。
有人可以告诉我如何避免这个问题吗?
修改 脚本:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import win32com.client
lib = win32com.client.Dispatch("AutoCAD.Application")
同时给出错误:
Traceback (most recent call last):
File "C:/Ab*******/comtypetest.py", line 6, in <module>
acad = comtypes.client.CreateObject("AutoCAD.Application")
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 227, in CreateObject
clsid = comtypes.GUID.from_progid(progid)
File "C:\Python27\lib\site-packages\comtypes\GUID.py", line 78, in from_progid
_CLSIDFromProgID(unicode(progid), byref(inst))
File "_ctypes/callproc.c", line 945, in GetResult
WindowsError: [Error -2147221005] Invalid class string
至于第一个,IE正在启动而没有出现。