Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed

Edu V Magadan

After installing pywinauto I'm trying to run that simple code:

from pywinauto import Application

filename = 'notepad.exe'
app = aplication.Application().start(filename)

And get the error:

Traceback (most recent call last):
  File "D:\auto\retr\test.py", line 1, in <module>
    from pywinauto import Application
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\__init__.py", line 89, in <module>
    from . import findwindows
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
    from . import controls
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\controls\__init__.py", line 36, in <module>
    from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\controls\uiawrapper.py", line 42, in <module>
    from .. import backend
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\backend.py", line 35, in <module>
    from .base_wrapper import BaseWrapper
  File "D:\Users\222\AppData\Local\Programs\Python\Python39\lib\site-packages\pywinauto\base_wrapper.py", line 44, in <module>
    import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.

If I do import of win32ui explicitly:

import win32ui
from pywinauto import Application

The error got simpler, but still nothing to do with:

Traceback (most recent call last):
  File "D:\auto\retr\test.py", line 1, in <module>
    import win32ui
ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed.

I googled similar issues, but did not find any solution..

I have Win10, python 3.9

JohnMetta

It would appear this is a duplicate of Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

From the looks of that and the Github page, import win32ui is actually broken on Python 3.9 using pywin32 build 228. There is a workaround posted in the other question. The short story is that build 229 is preferred, and until that release, the Github page has a workaround by manually installing a fork of the 228 build that is patched or a manual version of the 229 build.

For convenience, the .whls can be found here. Download the appropriate file and use:

pip install -U --force-reinstall <FILE>.whl

and the problem will most likely be fixed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Python

ImportError: DLL load failed: The file cannot be accessed by the system

From Javascript

Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

From

Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

From Dev

paramiko ImportError: DLL load failed: The operating system cannot run %1

From Dev

FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed

From Dev

Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

From Dev

importError: DLL load failed(import h5py)

From Dev

Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

From Dev

DLL load failed: The specified module could not be found while importing scipy

From Dev

Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

From Dev

How to fix "ImportError: DLL load failed" while importing win32api

From Dev

cx_Freeze ImportError: DLL load failed failed while importing _ctypes: The specified module could not be found

From Dev

"ImportError: DLL load failed while importing _openmp_helpers"?

From Dev

ImportError: DLL load failed while importing pyexpat: The specified module could not be found

From Dev

ImportError: DLL load failed: The file cannot be accessed by the system

From Dev

Pyinstaller ImportError : DLL load failed while importing win32gui

From Dev

Exception has occurred: ImportError DLL load failed while importing pdftotext: The specified module could not be found

From Dev

"ImportError: DLL load failed" when importing tensorflow

From Dev

Jupyter notebook does not launch (ImportError: DLL load failed while importing)

From Dev

Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

From Dev

ImportError: DLL load failed while importing _psycopg: The specified module could not be found

From Dev

"ImportError: DLL load failed while importing" while using PyInstaller

From Dev

ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

From Dev

How to fix 'ImportError: DLL load failed: The specified procedure could not be found.' while importing tensorflow-gpu?

From Dev

C#: A dynamic link library (DLL) initialization routine failed

From Dev

(ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found

From Dev

How to find which DLL failed in "ImportError: DLL load failed while importing" in python?

From Dev

How to fix "DLL load failed while importing QtWidgets"?

From Dev

How to fix Java 15 JNI "UnsatisfiedLinkError: A dynamic link library (DLL) initialization routine failed"

Related Related

  1. 1

    ImportError: DLL load failed: The file cannot be accessed by the system

  2. 2

    Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

  3. 3

    Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

  4. 4

    paramiko ImportError: DLL load failed: The operating system cannot run %1

  5. 5

    FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed

  6. 6

    Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

  7. 7

    importError: DLL load failed(import h5py)

  8. 8

    Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

  9. 9

    DLL load failed: The specified module could not be found while importing scipy

  10. 10

    Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

  11. 11

    How to fix "ImportError: DLL load failed" while importing win32api

  12. 12

    cx_Freeze ImportError: DLL load failed failed while importing _ctypes: The specified module could not be found

  13. 13

    "ImportError: DLL load failed while importing _openmp_helpers"?

  14. 14

    ImportError: DLL load failed while importing pyexpat: The specified module could not be found

  15. 15

    ImportError: DLL load failed: The file cannot be accessed by the system

  16. 16

    Pyinstaller ImportError : DLL load failed while importing win32gui

  17. 17

    Exception has occurred: ImportError DLL load failed while importing pdftotext: The specified module could not be found

  18. 18

    "ImportError: DLL load failed" when importing tensorflow

  19. 19

    Jupyter notebook does not launch (ImportError: DLL load failed while importing)

  20. 20

    Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

  21. 21

    ImportError: DLL load failed while importing _psycopg: The specified module could not be found

  22. 22

    "ImportError: DLL load failed while importing" while using PyInstaller

  23. 23

    ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

  24. 24

    How to fix 'ImportError: DLL load failed: The specified procedure could not be found.' while importing tensorflow-gpu?

  25. 25

    C#: A dynamic link library (DLL) initialization routine failed

  26. 26

    (ibm_db) ImportError: DLL load failed while importing ibm_db: The specified module could not be found

  27. 27

    How to find which DLL failed in "ImportError: DLL load failed while importing" in python?

  28. 28

    How to fix "DLL load failed while importing QtWidgets"?

  29. 29

    How to fix Java 15 JNI "UnsatisfiedLinkError: A dynamic link library (DLL) initialization routine failed"

HotTag

Archive