This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author craigh
Recipients christian.heimes, craigh, ggenellina, johnshue, loewis, mhammond
Date 2009-01-02.04:51:25
SpamBayes Score 5.156997e-11
Marked as misclassified No
Message-id <1230871887.45.0.34426692633.issue4566@psf.upfronthosting.co.za>
In-reply-to
Content
> 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
History
Date User Action Args
2009-01-02 04:51:27craighsetrecipients: + craigh, loewis, mhammond, ggenellina, christian.heimes, johnshue
2009-01-02 04:51:27craighsetmessageid: <1230871887.45.0.34426692633.issue4566@psf.upfronthosting.co.za>
2009-01-02 04:51:26craighlinkissue4566 messages
2009-01-02 04:51:25craighcreate