尝试在Python中执行AutoIT脚本的错误消息

时间:2018-07-27 02:41:52

标签: python autoit

您好,我正在尝试自动执行文件删除过程,这是我的Python脚本,通过win32com模块导入了AutoIT

from selenium import webdriver
import win32com.client

driver = webdriver.Chrome()
driver.get("https://tinyjpg.com/")
assert "TinyJPG" in driver.title

droplocation = driver.find_element_by_class_name("icon")
droplocation.click()
autoit = win32com.client.Dispatch("AutoItX3.Control")
autoit.Run(r"filedrop.exe")

但是,我遇到了这个错误:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Tea\Desktop\compressimg.py", line 30, in <module>
    autoit = win32com.client.Dispatch("AutoItX3.Control")
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

我能找到的最相似的帖子是:win32com (python) error,但是我认为网站应该是COM服务器,因此在这里并没有实际意义吗?

无论如何,我不太确定错误是想告诉我什么,我们将不胜感激!

0 个答案:

没有答案