Eryk Sun <eryk...@gmail.com> added the comment: In 3.8+, the DLL search path for dependent DLLs when importing extension modules excludes PATH and the current working directory. So it's far less likely for an import to fail with ERROR_BAD_EXE_FORMAT.
Currently the error message in Python 3 includes the base name of the extension module, e.g. "DLL load failed while importing _spam". No error codes are special cased to use custom error messages, so it still includes the localized error text from the system, which may contain parameterized inserts (%). The common errors when importing an extension module are missing and mismatched dependent DLLs: ERROR_MOD_NOT_FOUND (126) and ERROR_PROC_NOT_FOUND (127). The system messages for these two errors do not contain inserts. For example, if the UI language is Japanese, a missing DLL dependency raises the following exception: ImportError: DLL load failed while importing _spam: 指定されたモジュールが見つかりません。 ---------- components: +Extension Modules type: -> behavior versions: +Python 3.10, Python 3.9 -Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue25585> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com