471,086 Members | 862 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

Help: Runtime Error when loading ".pyd" module

Hi There,

We are extending Python interpreter to support special functions of our
tools. What we did is to compile Python's source code (which is got from the
an installation on a Linux environment for Python 2.3.3) and our extensions
(C++ code) on Windows with Microsoft Visual C++ 6.0 compiler to generate the
extended Python interpreter.

It works well on Linux and for the basic Python modules and our special
modules on Windows. But whenever a ".pyd" module is loaded by a statement
like the following:
import socket; # which finally calls: import _socket
import Tkinter; # which finally calls: import _tkinter
import datetime
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
Fatal Python error: Interpreter not initialized (version mismatch?)
I tried to use Microsoft Visual Studio to debug the program and set a
breakpoint at "Py_FatalError()", but the breakpoint is not hit. I also
traced the loading process of the ".pyd" file in function
"_PyImport_LoadDynamicModule()": the ".pyd" file is correctly located and
loaded, and its "init" function seems be got correctly, but when the
initialization function is called, the above error happens.

I am pretty sure that Python is initialized by "Py_Initialize()", and the
".pyd" files are from the standard Python installation with the same version

Does anyone have any idea about the crash? Does the initialization function
from a ".pyd" file require special environment?

Because the ".pyd" files (like "_socket.pyd", _tkinter.pyd" and
"datetime.pyd" etc) are precompiled and contained in the Python installer
for Windows, I don't know how to manually compile them and debug them.

I appreciate your help in advance.

Mar 2 '06 #1
0 1633

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by python-help-bounces | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.