0

When I try to run this script, I get this error:

Traceback (most recent call last):
  File "C:/Users/itsan/Desktop/Coding/Python/Enter.py", line 4, in <module>
    from pywinauto import Desktop, Application, keyboard
  File "C:\Users\itsan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pywinauto\__init__.py", line 59, in <module>
    import win32api  # noqa: E402
ImportError: DLL load failed: The specified module could not be found.

This is my script:

import keyboard
import time
from pywinauto import Desktop, Application, keyboard 
from pywinauto.application import Application 

app = Application().start("BlueStacks")

while True:
    if keyboard.is_pressed('enter'):
        time.sleep(1)
        app.window_(title_re="BlueStacks").window_(title="Send").click()
#2
        app.window_(best_match="BlueStacks" ).window_(best_match="Send").click()

I ran pip install pypiwin32 in the cmd , and it returned this:

Requirement already satisfied: pypiwin32 in c:\users\itsan\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (223)
Requirement already satisfied: pywin32>=223 in c:\users\itsan\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from pypiwin32) (227)

I'm using IDLE python (3.7.6)

AMC
  • 2,642
  • 7
  • 13
  • 35
itsanantk
  • 264
  • 1
  • 9
  • “import win32api” - that’s the failing import. Search for “python importerror win32api” and there will likely be many duplicates. – user2864740 Feb 28 '20 at 01:38
  • Does this answer your question? [ImportError: no module named win32api](https://stackoverflow.com/questions/21343774/importerror-no-module-named-win32api) – AMC Feb 28 '20 at 02:15

0 Answers0