Skip to content Skip to sidebar Skip to footer

Python 'No Module Named Win32gui' After Installing Pywin32

Running python 3.6 on windows 8. ModuleNotFoundError: No module named 'win32gui' I have tried multiple installations of pywin32 but none have worked so far. https://sourceforge.ne

Solution 1:

from win32.win32gui import FindWindow, GetWindowRect, MoveWindow

I guess the standard model name is win32, so all the tutorial on web is outdated. For whatever said before v300, add"win32." before the model name to give a parent modelname which is "win32"


Solution 2:

This looks very much like a 32-bit/64-bit issue. If you are running 64-bit Python and you have 32-bit PythonWin you will see this sort of thing. Both win32gui and win32ui are .pyd files (DLLs) and they should live in Lib\site-packages\win32 and Lib\site-packages\pythonwin respectively.

If you can see them there but the import is failing then it is likely they are the wrong bitness. A 64-bit executable cannot load a 32-bit DLL and vice versa, and if you try, in most cases the error message will tell you that the DLL you are trying to load isn't there. Even when you can see that it is.

Edit following exchange of comments with OP:

You will also get this sort of error with PythonWin if you put multiple imports in a single line. Follow PEP-8 and do one import to a line.


Post a Comment for "Python 'No Module Named Win32gui' After Installing Pywin32"