Python 2.7.3 shared library, like _socket.pyd, cannot be loaded

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Python 2.7.3 shared library, like _socket.pyd, cannot be loaded

Terry Tang-2
Hi There,

I am integrating Python 2.7.3 into our system on Windows. We embedded Python 2.7.3 interpreter to our system.

The problem we met is, our extended Python interpreter cannot load "_socket.pyd" when "import socket" is executed, for example. Here is the error:

Traceback (most recent call last):
  File "", line 1, in <module>
    import socket;
  File "C:\trunk1\third_party\python-2.7.3\win32\lib\", line 47, in <mo
    import _socket
ImportError: DLL load failed: The specified module could not be found.

I wrote a small program as listed below to manually load "_socket.pyd" from Python 2.7.3 binary installation  on Windows, and got the same failure.

static void TestDllLoad(const char *dllPath)
    if (socketh == NULL) {
fprintf(stderr, "Failed to load shared library: %s\nError: %d\n", dllPath,  GetLastError());
    } else {
fprintf(stderr, "Successfully load shared library: %s\n", dllPath);

int main()
    /* The following loading success. */
    /* The following loading failed. */
    return 0;

I tried MSVC 2008 and a third-party compiler, and got the same result, even after copying "python27.dll" to the testing directory from Python 2.7.3 installation on Windows.

There is a similar failure reported in, but it is marked as fixed and closed. 

Anyone has any idea about the problem?

Thanks a lot.


Python-Dev mailing list
[hidden email]