Search code examples
pythonautomationanacondaspyderpywinauto

How can I fix ModuleNotFoundError?


I've installed pywinauto via pip in the command prompt (with admin). When run in Microsoft Visual Studio Code, the code runs fine. However, when I attempt to run in Spyder (through anaconda) I am confronted with the error message below. I'm trying to use this script for app automation, but can't seem to get past this first step. I looked up the github and it gave what I believe to be an answer here: https://github.com/mhammond/pywin32#:~:text=A%20very%20common,version%20%2D%20eg%2C%20%2239%22), however I don't know how to execute this or if it's the actual answer.

Code:

   from pywinauto import Application

   app = Application()

Error Message:

Traceback (most recent call last):

File "C:\Users(redacted)\Documents\Canvaauto.py", line 1, in from pywinauto import Application # upper 'A'

ModuleNotFoundError: No module named 'pywinauto'


Solution

  • I had determined that the version of python I was attempting to use (3.10) was unsupported by pywinauto and so I tried again with Python 3.8. Thank you to everyone who offered an answer to this.