How does one get from "ImportError: DLL load failed:..." to a culprit .dll and symbol?

Gabriel Genellina gagsl-py2 at
Mon Feb 23 08:49:59 EST 2009

En Mon, 23 Feb 2009 10:41:20 -0200, Chris Cormie  
<ccormie at> escribió:

>> If that not-very-technical description [all I've ever needed] doesn't
>> help, you'll need to read the DW help file (HTFF1K) or wait till
>> someone who knows what they are doing comes along :-)
> LOL, I am that person :p
> Your technique works well and it does provide the information and it is  
> a (roundabout) solution to this class of problems:  thank you very much.  
> It doesn't answer the original question so I'll restate it:
> How do you get *Python* to tell you the dll and the problem symbol? Not  
> external tools, Python. Python at a low level is calling LoadLibrary and  
> GetProcAddress to resolve symbols and the call fails. At that point it  
> has the name of the dll and the problem symbol to hand and yet strangely  
> only gives an opaque error message. How does one get Python to print out  
> the faulty DLL and symbol?

You can't, because it isn't Python who's trying to load the symbol - the  
*only* symbol that Python attempts to import itself is "initFOO" from  
FOO.pyd, and when that fails you get an explicit message.
The error you see must come from the extension itself, and propagates into  
Python as an ImportError.

Gabriel Genellina

More information about the Python-list mailing list