0

I am trying to imort the pywin32 library, but I am getting an error.

import win32api
ImportError: DLL load failed: %1 is not a valid Win32 application.

or

import win32gui 
ImportError: DLL load failed: %1 is not a valid Win32 application.

Does anybody know what the problem might be?

Charles
  • 1
  • 1
  • I don't think this question is duplicated, since win32api is used in many other packages. Anyways, just in case someone stumbles upon this, after October 2019: 1. you need have pywin32 installed. 2. use **pywin version 224**, since versions after October 2019 are broken – gciochina Dec 19 '19 at 10:24

1 Answers1

0

The bitness of the packages you have installed differs; make sure all of the programs/libraries have the same bitness.

  • If you are running a 32-bit version of Windows, make sure you have the 32-bit version of Python and the 32-bit version of PyWin32
  • If you are running a 64-bit version of Windows, make sure you have the 64-bit version of Python and the 64-bit version of PyWin32
Sam van Kampen
  • 973
  • 9
  • 17