0

Hello I'm trying to automate a file drop process and here's my Python script, with AutoIT imported via the win32com module

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")

However, I got this error:

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)

The most similar post I could find was this: win32com (python) error, but I think websites are supposed to be COM servers so that's not really relevant here?

In any case, I'm not too sure what the error is trying to tell me, help is appreciated!

2
  • reg query HKEY_CLASSES_ROOT\AutoItX3.Control. Run that command at a command prompt. If you get an error then you may need the register the AutoIt DLLs. AutoItX3.dll for x86 and AutoItX3_x64.dll for x64. The COM server you mention operates in the OS. You can use regsvr32.exe to register the DLLs if needed. Commented Jul 28, 2018 at 1:17
  • @michael_heath thanks for the suggestion! but I just checked and I already have all the AutoItX3.dll files required. Seems like that's not the issue :/ Commented Jul 29, 2018 at 2:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.