<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hi There,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I am integrating Python 2.7.3 into our system on Windows. We embedded Python 2.7.3 interpreter to our system.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">The problem we met is, our extended Python interpreter cannot load "_socket.pyd" when "import socket" is executed, for example. Here is the error:</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;
 "><br></div><div><div><font face="'times new roman', 'new york', times, serif">Traceback (most recent call last):</font></div><div><font face="'times new roman', 'new york', times, serif">&nbsp; File "t.py", line 1, in &lt;module&gt;</font></div><div><font face="'times new roman', 'new york', times, serif">&nbsp; &nbsp; import socket;</font></div><div><font face="'times new roman', 'new york', times, serif">&nbsp; File "C:\trunk1\third_party\python-2.7.3\win32\lib\socket.py", line 47, in &lt;mo</font></div><div><font face="'times new roman', 'new york', times, serif">dule&gt;</font></div><div><font face="'times new roman', 'new york', times, serif">&nbsp; &nbsp; import _socket</font></div><div><font face="'times new roman', 'new york', times, serif">ImportError: DLL load failed: The specified module could not be found.</font></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><font face="'times new roman', 'new
 york', times, serif"><br></font></div></div><div><div><span style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I wrote a small program as listed below to manually load "_socket.pyd" from Python 2.7.3 binary installation &nbsp;on Windows, and got the same failure.</span></div><div><font face="'times new roman', 'new york', times, serif"><br></font></div><div><span><font face="'times new roman', 'new york', times, serif"><div>static void TestDllLoad(const char *dllPath)</div><div>{</div><div>&nbsp; &nbsp; HINSTANCE socketh=LoadLibraryEx(dllPath,&nbsp;NULL,&nbsp;LOAD_WITH_ALTERED_SEARCH_PATH);</div><div>&nbsp; &nbsp; if (socketh == NULL) {<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fprintf(stderr, "Failed to load shared library: %s\nError: %d\n", dllPath, &nbsp;GetLastError());</div><div>&nbsp; &nbsp; } else {</div><div><span class="Apple-tab-span" style="white-space:pre">
        </span>fprintf(stderr, "Successfully load shared library: %s\n", dllPath);</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; /* The following loading success. */</div><div>&nbsp; &nbsp;&nbsp;TestDllLoad("&lt;PathToPython2.3.3&gt;\\DLLs\\_socket.pyd");</div><div><div>&nbsp; &nbsp; /* The following loading failed. */</div><div>&nbsp; &nbsp; TestDllLoad("&lt;PathToPython2.7.3&gt;\\DLLs\\_socket.pyd");</div><div>&nbsp; &nbsp; return 0;</div>}</div><div><br></div><div>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.</div><div><br></div><div>There is a similar failure reported in&nbsp;<a href="http://bugs.python.org/issue4566">http://bugs.python.org/issue4566</a>, but it is marked as fixed and closed.&nbsp;</div><div><br></div><div>Anyone has any idea about the
 problem?</div><div><br></div><div>Thanks a lot.</div><div><br></div><div>-Terry</div></font></span></div></div></div></body></html>