[issue25655] Python errors related to failures loading DLL's lack information

Eryk Sun report at bugs.python.org
Thu Oct 22 11:50:30 EDT 2020


Eryk Sun <eryksun at gmail.com> added the comment:

Steve, the PR that you pushed has the wrong error and error message. I told Philippe in msg377335 that ctypes raises FileNotFoundError with no error code. For example:

    >>> try: ctypes.CDLL('spam')
    ... except OSError as e: err = e
    ...
    >>> err
    FileNotFoundError("Could not find module 'spam' (or one of its dependencies). Try using the full path with constructor syntax.")
    >>> err.winerror is None
    True

The advice to use dumpbin is fine and works well in simple cases. I wouldn't use it generally since recursiveley parsing through the dependency graph of every dependent DLL could be tedious.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue25655>
_______________________________________


More information about the Python-bugs-list mailing list