Title: Improve ctypes error reporting with missing DLL path
Type: enhancement Stage: resolved
Components: ctypes Versions: Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: The Compiler, altendky, eric.smith, paul.moore, pombredanne, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2020-09-22 14:04 by pombredanne, last changed 2020-09-22 14:16 by pombredanne. This issue is now closed.

Messages (3)
msg377322 - (view) Author: Philippe Ombredanne (pombredanne) * Date: 2020-09-22 14:04
When the dependency of a DLL is missing (at least on Windows) the error " OSError: [WinError 126] The specified module could not be found" is raised when calling ctypes.CDLL(dll_path) even when this "dll_path" exists... because the error comes from another DLL.

These errors are really hard to diagnose because the path of the missing DLL is not returned in the exception message. Returning it would help fixing these kind of errors quickly.

Researching errors such as this one wastes quite a bit of time and would be made a non issue if we had the path in the error message.
msg377324 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-09-22 14:13
My understanding is that Windows doesn't tell you which DLL is missing. I think the best we could do is append something to the error message saying "or one its dependencies".
msg377325 - (view) Author: Philippe Ombredanne (pombredanne) * Date: 2020-09-22 14:16
Eric, Thanks!
This is IMHO a dupe of in earnest. So I am closing this in favor of that and will carry over comments there
Date User Action Args
2020-09-22 14:16:25pombredannesetstatus: open -> closed
messages: + msg377325

components: - Windows
resolution: duplicate
stage: resolved
2020-09-22 14:13:47eric.smithsetnosy: + eric.smith, zach.ware, paul.moore, tim.golden, steve.dower
messages: + msg377324
components: + Windows
2020-09-22 14:08:16The Compilersetnosy: + The Compiler
2020-09-22 14:07:53altendkysetnosy: + altendky
2020-09-22 14:04:23pombredannecreate