LoginSignup
P488
@P488

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

pywinautoのエラー「イベントはどのサブスクライバーも呼び出すことができませんでした」について

解決したいこと

Python(v3.9.6)でpywinautoを利用してアプリケーションの操作を行ったところ、エラーが発生しました。
エラーの意味と解決方法を教えてください。

発生している問題・エラー

Traceback (most recent call last):
  File "pywinauto\application.py", line 427, in exists
  File "pywinauto\application.py", line 250, in __resolve_control
  File "pywinauto\timings.py", line 436, in wait_until_passes
  File "pywinauto\application.py", line 222, in __get_ctrl
  File "pywinauto\findwindows.py", line 84, in find_element
  File "pywinauto\findwindows.py", line 305, in find_elements
  File "pywinauto\findbestmatch.py", line 495, in find_best_control_matches
  File "pywinauto\findbestmatch.py", line 474, in build_unique_dict
  File "pywinauto\findbestmatch.py", line 320, in get_control_names
  File "pywinauto\findbestmatch.py", line 219, in get_non_text_control_name
  File "pywinauto\base_wrapper.py", line 367, in rectangle
  File "pywinauto\uia_element_info.py", line 326, in rectangle
_ctypes.COMError: (-2147220991, 'イベントはどのサブスクライバーも呼び出すことができませんでした', (None, None, None, 0, None))

該当するソースコード

def main():
    title = "アプリケーション名"
    handle = pywinauto.timings.wait_until_passes(
        1,
        3,
        lambda: pywinauto.findwindows.find_window(
            title_re = title
        )
    )
    # アプリケーションを取得する
    application = pywinauto.Application(backend=backend)
    application.connect(handle=handle)
    window = application[title]
    label = None
    label = window["接続する"]
    if label.exists(): # ログによると、この行でエラーが発生
        button = window["Connect"]
        button.click()
0

No Answers yet.

Your answer might help someone💌