_except_handler4_common could not be located (py2exe)

When developing python2.7 py2exe applications on Windows Vista or Windows 7, and deploying the applications to windows XP, some of the DLL files that may be automatically included in your distribution directory may trigger an error message such as the following because they import an incorrect version of msvcrt:

_except_handler4_common could not be located in the dynamic link library msvcrt.dll

One annoying thing is that py2exe is incorrect, and these DLL files don’t actually need to be included for your program to function correctly. Another annoying thing is that the DLL files that trigger this error message are not always the same. Some people have found it to be MSWSOCK.DLL, or DWMAPI.DLL.

To this list I can add DNSAPI.DLL as a DLL file that I had to exclude to remove this error.

And for good measure, USP10.DLL had to be excluded to remove a different error…

Leave a Reply

Your email address will not be published. Required fields are marked *