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

John Machin sjmachin at lexicon.net
Mon Feb 23 01:38:47 EST 2009


On Feb 23, 2:56 pm, Chris Cormie <ccor... at aussiemail.com.au> wrote:
> Hi,
>
> I've been Googling around on a moderately common Windows Python problem:
> a mismatch between the symbols a python extension thinks are available
> and the contents of the associated DLL. Python users running into this
> problem are greeted with:
>
> import <somemodule>
> "ImportError: DLL load failed: The specified procedure could not be found."
>
> That's it: no mention of which dll nor which symbol is causing the
> problem. Both these pieces of information are helpful/important in
> resolving this class of problem: how does one get Python to dump this
> debugging data?
>
> (>python -v -d
> doesn't help, BTW)

Use -vv ... you need to know exactly which of possibly many
incarnations of somemodule.pyd Python is trying to import from.

Then get a copy of the Dependency Walker from http://www.dependencywalker.com/

Open c:\the\failing\somemodule.pyd with the DW. Look at grumble
messages in the bottom pane. Note: you often get 1 or 2 warning
messages with a pyd that's not having problems. Scroll through all the
modules in the middle pane, looking for grumbles.

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

By the way, I presume that you are aware that extensions on Windows
are tied to a particular version of Python ... you would have got a
different error message if you had a version mismatch (I think). If
your problem is not obvious, come back here with:
-- what version of Python you are running
-- what DLLs you find in the middle pane whose names match
   (1) MSVC*.DLL
   (2) PYTHON??.DLL

You may need to answer questions about the extension (e.g. compiler/
linker options used) -- is it your extension or a 3rd party's?

HTH,
John



More information about the Python-list mailing list