[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 16:15:08 EST 2015
eryksun added the comment:
Steve, do you think it's OK to abandon localization for exception messages? If so, should we be using English for all FormatMessage calls? It's a bit ugly that Python's exceptions and the CRT error messages are in English, but then whenever we call FormatMessage with LANG_NEUTRAL/SUBLANG_DEFAULT we're getting localized error text. For example, the import error in the following case has a mix or Russian and English:
import io, sys, ctypes
kernel32 = ctypes.WinDLL('kernel32')
MUI_LANGUAGE_NAME = 8
kernel32.SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, u'ru-RU\0', None)
kernel32.SetConsoleOutputCP(1251)
sys.stderr = io.TextIOWrapper(open(r'\\.\con', 'wb'), encoding='1251')
open('blah.pyd', 'w').close()
>>> import blah
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 не является приложением Win32.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25585>
_______________________________________
More information about the Python-bugs-list
mailing list