Runtime Error when loading ".pyd" module

Terry Tang terry at ghs.com
Mon Mar 6 11:56:33 EST 2006


Fredrik,

Thanks, the information is very helpful, and I have resolved our problem. I
was not aware that the .pyd files will load pythonNN.dll.

Regards.

-Terry


----- Original Message ----- 
From: "Fredrik Lundh" <fredrik at pythonware.com>
To: <python-list at python.org>
Sent: Thursday, March 02, 2006 12:53 AM
Subject: Re: Runtime Error when loading ".pyd" module


> Terry Tang wrote:
>
> > it hits a "Runtime Error" (which is shown in a message box saying
"abnormal
> > program termination") and a message like the following is printed in the
> > console:
> > Fatal Python error: Interpreter not initialized (version mismatch?)
>
> both the main executable (e.g. python.exe or your own application)
> and the various PYD files are linked against the Python core DLL (e.g.
> python24.dll), and this error typically indicates that the PYD picks up
> another copy of that DLL than the EXE is using.
>
> e.g.
>
> 1. python.exe starts
> 2. when python.exe needs python24.dll, the runtime linker finds
>         /foo/bar/python24.dll and loads it
> 3. python.exe initializes the python24.dll instance
> 4. python.exe starts your python program
> 5. your python program imports the foobar module
> 6. python.exe loads /foo/modules/foobar.pyd for you
> 7. when foobar.pyd needs python24.dll, the runtime linker finds
>         /flub/python24.dll before /foo/bar/python24.dll
> 8. foobar.pyd calls /flub/python24.dll, which notices that it hasn't
>         been properly initialized, and terminates.
>
> another possible option is that foobar.pyd is from an earlier python
> version, so you get
>
> 7. when foobar.pyd needs python23.dll, the runtime linker finds
>         /foo/bar/python23.dll and loads it
> 8. foobar.pyd calls /foo/bar/python23.dll, which notices that it
>         hasn't been properly initialized, and terminates.
>
> but the PYD loader used in step 6 has extra logic in it to attempt
> to detect this case (it checks what python DLLs a PYD file is using
> before it loads the PYD), so you usually get a better error message
> if this is the case.
>
> anyway, the first thing to do is to look for stray pythonXX.dll files
> ("python23.dll" in your case).
>
> hope this helps!
>
> </F>
>
>
>
>
>




More information about the Python-list mailing list