[issue40610] ctypes on Windows: error message on DLL load failure is misleading

2020-05-12 Thread Eryk Sun


Eryk Sun  added the comment:

bpo-39393 improved the error message to mention "(or one of its dependencies)". 
That's the best we can reasonably do. A developer can monitor "loader snaps" 
messages in a debugger in order to discover the missing DLL and the directories 
where the loader looked for it.

--
nosy: +eryksun
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Misleading error message upon dependent DLL resolution failure

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40610] ctypes on Windows: error message on DLL load failure is misleading

2020-05-12 Thread Jack Jansen


New submission from Jack Jansen :

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  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  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com