[issue40610] ctypes on Windows: error message on DLL load failure is misleading
Jack Jansen
report at bugs.python.org
Tue May 12 19:04:27 EDT 2020
New submission from Jack Jansen <Jack.Jansen at cwi.nl>:
On Windows, when ctypes fails to load a DLL, the error message is misleading. If a dependency of the DLL cannot be found if appears as if the DLL itself cannot be found.
This issue has always existed on Windows (and I know it is due to what the OS provides by default as its error message) but it is exacerbated by the DLL loading rules in Python 3.8 (the `os.add_dll_directory()` changes), because now importing a DLL into Python will follow different rules than those followed by, for example, command line utilities shipped with the DLL you are loading follow.
An ideal fix would be a message of the form "xxx.dll failed to load because its dependency yyy.dll is not on the current Python DLL search path, see zzzz for details". But I am not well-versed enough in Windows APIs to know whether that is even possible.
A fix that is minimal and at least not misleading would be a message "xxx.dll (or one of its dependencies) failed to load. See zzzz for details".
----------
components: ctypes
messages: 368748
nosy: jackjansen
priority: normal
severity: normal
status: open
title: ctypes on Windows: error message on DLL load failure is misleading
type: enhancement
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40610>
_______________________________________
More information about the Python-bugs-list
mailing list