Skip to content

KeyError and TypeError occurred #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
haha198566 opened this issue Jan 6, 2020 · 3 comments
Closed

KeyError and TypeError occurred #108

haha198566 opened this issue Jan 6, 2020 · 3 comments

Comments

@haha198566
Copy link

win10 64bit OS
I installed py3.7.6 64bit and depends on comtypes and typing, run CMD as administrator,when I run automation.py -h,some error occurred:
C:\python37\Scripts>automation.py -h
UIAutomation 2.0.3 (Python 3.7.6, 64 bit)
please wait for 3 seconds

2020-01-06 16:22:28.715 automation.py[75] main -> Starts, Current Cursor Position: (2168, 403)
Traceback (most recent call last):
File "C:\python37\lib\ctypes_init_.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'ctypes.c_long'>, <class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.LP_POINTER(IUIAutomationCondition)'>), 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\python37\Scripts\automation.py", line 113, in
main()
File "C:\python37\Scripts\automation.py", line 97, in main
control = auto.GetFocusedControl()
File "C:\python37\lib\site-packages\uiautomation\uiautomation.py", line 7465, in GetFocusedControl
return Control.CreateControlFromElement(_AutomationClient.instance().IUIAutomation.GetFocusedElement())
File "C:\python37\lib\site-packages\uiautomation\uiautomation.py", line 51, in instance
cls._instance = cls()
File "C:\python37\lib\site-packages\uiautomation\uiautomation.py", line 56, in init
self.UIAutomationCore = comtypes.client.GetModule("UIAutomationCore.dll")
File "C:\python37\lib\site-packages\comtypes\client_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\python37\lib\site-packages\comtypes\client_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\python37\lib\site-packages\comtypes\client_generate.py", line 24, in my_import
return import(fullname, globals(), locals(), ['DUMMY'])
File "C:\python37\lib\site-packages\comtypes\gen_944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py", line 1729, in
( ['out', 'retval'], POINTER(POINTER(IUIAutomationElement)), 'element' )),
File "C:\python37\lib\site-packages\comtypes_init
.py", line 329, in setattr
self.make_methods(value)
File "C:\python37\lib\site-packages\comtypes_init
.py", line 698, in make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\python37\lib\ctypes_init
.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 2 in argtypes passes a union by value, which is unsupported.
please help

@pangshu2007
Copy link

Me too.

@burque505
Copy link

Win7 Pro SP1,64-bit, identical error.

@yinkaisheng
Copy link
Owner

yinkaisheng commented Feb 21, 2020

Do not use 3.7.6 and 3.8.1, install an earlier version or wait for the next version.
enthought/comtypes#202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants