[issue25585] Bad path leads to: ImportError: DLL load failed: %1 is not a valid Win32 application.

eryksun report at bugs.python.org
Mon Nov 9 01:02:01 EST 2015


eryksun added the comment:

The "DLL load failed" message is from Python, but the rest is the text for the Windows error code, ERROR_BAD_EXE_FORMAT (0x00c1) [1]. The "%1" in the string can be expanded as the first element of the Arguments array parameter of FormatMessage [2]. But currently the code in Python/dynload_win.c uses FORMAT_MESSAGE_IGNORE_INSERTS and does no post-processing to replace the "%1".

I don't know why the Windows loader reported ERROR_BAD_EXE_FORMAT instead of ERROR_MOD_NOT_FOUND. Possibly it found another version of a dependent DLL that was corrupt or for a different architecture. 

Note that the setup in this case is odd in that the package is installed in C:\Python27 instead of in the site-packages directory.

[1]: https://msdn.microsoft.com/en-us/library/ms681382#ERROR_BAD_EXE_FORMAT
[2]: https://msdn.microsoft.com/en-us/library/ms679351

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25585>
_______________________________________


More information about the Python-bugs-list mailing list