[issue42529] CPython DLL initialization routine failed from PYC cache file

Eryk Sun report at bugs.python.org
Sat Dec 19 01:40:34 EST 2020


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

> ImportError: DLL load failed while importing _jpype: 
> A dynamic link library (DLL) initialization routine failed.

With loader snaps enabled for python[_d].exe (i.e. loader debug messages), you can attach a debugger to discover which DLL's init routine is failing. For example, you'll see a debug message like the following:

    xxxx:xxxx @ xxxxxxxx - LdrpInitializeNode - ERROR:
    Init routine XXXXXXXXXXXXXXXX for DLL "Path\To\DLL"
    failed during DLL_PROCESS_ATTACH

The entry point of a DLL is typically _DllMainCRTStartup, which initializes the CRT for the DLL and calls DllMain(). In any case, you can find the relative address of the entry point in the PE header, via dumpbin.exe or the debugger !dh command. Set a breakpoint on it and step through to find where it fails in comparison with a working environment.

----------
nosy: +eryksun

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


More information about the Python-bugs-list mailing list