Craig Holmquist <craigh...@gmail.com> added the comment: > test.c's error is "can't find the DLL" - this will be as we attempt to > load Python's DLL - but this isn't the same as the original error, which > is "DLL init routine failed". To repro the initial error, I suspect you > will want to put the full assembly next to test.exe - that will allow > python.dll to load - then test.c should call PyExec_EvalString("import > socket\n") - it is at *that* point the error we care about is likely to > be thrown.
The test program isn't having a problem loading python26.dll - it gets to an interpreter prompt and it can execute simple Python statements. It doesn't throw ImportError until the user types in "import socket". Further, I can see in Process Explorer that python26.dll is loaded in the running testpy.exe process. I apologize if my initial description wasn't clear on that point. I do see the error codes are different (between testpy.c and mod_python), but both are triggered by trying to load _socket.pyd. Nonetheless: if I copy the CRT assembly into the same folder as testpy.exe, I get a popup dialog when I try to import socket, saying "Runtime Error!" and "R6034; An application has made an attempt to load the C library incorrectly.". When I click OK in that dialog, I get this error in the console running testpy.exe: ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. (If the assembly is not in the folder, there is no popup dialog at all.) So it does indeed change the error code received. Also, I see now that I made a mistake in reporting the error code from the Apache log. The actual behavior is this: * Ordinary, the ImportError is: ImportError: DLL load failed: The specified module could not be found. * However, if I put the CRT assembly in the same folder as _socket.pyd: ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. and I received the same popup dialog as above. Putting the CRT assembly in the Apache bin folder or Apache modules folder still gives the first error (module could not be found). I apologize for the confusion; when I first experienced this problem I tried to fix it by experimenting with putting the manifest in various folders and I wasn't paying close enough attention to what error was given when. To summarize: testpy.exe with CRT assembly in testpy.exe folder: init routine failed and popup. testpy.exe with CRT assembly in _socket.pyd folder: init routine failed and popup. testpy.exe otherwise: module could not be found Apache with CRT assembly in _socket.pyd folder: init routine failed and popup. Apache otherwise: module could not be found _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4566> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com