"AttributeError: 'module' object has no attribute 'CUIAutomation"

1.1k views Asked by At

Hello I've similar problem like this:

Py2Exe error caused by pywinauto on some systems: "AttributeError: 'module' object has no attribute 'CUIAutomation"

with py2exe and also pyinstaller I get error:

AttributeError: module 'comtypes.gen.UIAutomationClient' has no attribute 'CUIAutomation' [15964] Failed to execute script SVGWalker

Without py2exe or pyinstaller the script is running without errors !!

Here my startup python code:

#################################################################
# Version String
#################################################################
__version__ = "1.4.1.0"





#import WindowHandler
#import win32com.client
#import pywinauto
from pywinauto import application
from pywinauto import timings
from pywinauto import ElementNotFoundError
from pywinauto import Desktop
#import comtypes.client # 02.10.2020
import glob
import time
import sys
import os
import argparse
import traceback
import helper
import XmlManifest

and the error: with line 13 above:

Traceback (most recent call last):
  File "SVGWalker.py", line 13, in <module>
    from pywinauto import application
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pywinauto\__init__.py", line 89, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pywinauto\findwindows.py", line 42, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pywinauto\controls\__init__.py", line 36, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pywinauto\controls\uiawrapper.py", line 47, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pywinauto\uia_defines.py", line 181, in <module>
  File "pywinauto\uia_defines.py", line 169, in _build_pattern_ids_dic
  File "pywinauto\uia_defines.py", line 50, in __call__
  File "pywinauto\uia_defines.py", line 63, in __init__
AttributeError: module 'comtypes.gen.UIAutomationClient' has no attribute 'CUIAutomation'
[5732] Failed to execute script SVGWalker

Nothing in the thread above helped me.

Is there any other hint or solution

0

There are 0 answers