6
votes

I'm trying to use the win32gui module included with pywin32 but I can't get it working.

I have downloaded it, built it and everything seem to be located under site-packages, I've found win32gui.pyd at site-packages/win32/win32gui.pyd but when I try to import it I get:

import pyHook, win32gui
ImportError: DLL load failed: The specified module could not be found.

Do I need to move a dll somewhere? and if so, which one?

7

7 Answers

3
votes

My guess is that win32gui depends on some DLL that is not on your system. You can download depends and see what you're missing.

However my first attempt will be try installing pywin32 from the installer, not by building it.

12
votes

This works:

import pywintypes
#import pythoncom # Uncomment this if some other DLL load will fail
import win32gui
6
votes

I had the same issue. I added the path where pywintypes34.dll to system path and it worked.

In my case it was C:\Python34\Lib\site-packages\pywin32_system32

3
votes

First check that "pywin32" module is installed in your system or not. If not installed then install it first. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32

If the issue still persists then now for the /Lib/site-packages/pywin32_system32 and add this path to system library or add pythoncom35.dll and pywintypes35.dll to the directory which is added to a system path.

3
votes

I tried to only "copy" pywin32 package once instead of installing it and it works well.

what i've done is :

  1. Copy over all the related packages to site-packages folder
  2. Copy pythoncom25.dll & pywintypes25.dll to c:\windows\system32 folder (you might need to change to version&system path)

Hope it helps

0
votes

Same problem, I installed from sourceforge and then I run the .exe as administrator.

0
votes

I wanted a win32gui module for which I installed the pywin32 module still error " DLL load failed while importing win32gui: The specified module could not be found", I went to folder pywin32_system32 folder in my virtual environment and copied DLLs and pasted inside win32 folder. worked for me