import pywinauto错误 / from pywinauto import application错误

时间:2024-04-13 18:06:44

KeyError: (<class ‘ctypes.HRESULT’>, (<class ‘ctypes.c_long’>, <class ‘comtypes.automation.tagVARIANT’>, <class ‘comtypes.LP_POINTER(IUIAutomationCondition)’

TypeError: item 2 in argtypes passes a union by value, which is unsupported.

导入pywinauto包执行后报错如上:
import os
import sys
import platform
from pywinauto.application import Application

问题原因:pywinauto只支持python3.7.4一下版本,而我用的是pytho3.7.6版本
C:\Programs\Python\Python37\Lib>python

Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

卸载后重新安装python3.6.4版本,再次执行后程序正常

C:\Users\Dell>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information
import pywinauto错误 / from pywinauto import application错误