Hi

I’m looking at upgrading our python installations from 2.6(.2) to 2.7 and upgrading the packages we use to the latest versions. We use python and the mod_wsgi module in Apache 2.2 for our application server and easy_install to install egg packages. I’m currently testing on a Windows 7 machine. The current egg version of lxml that we’re using (before upgrading) is:

 

lxml-2.2.4-py2.6-win32.egg

 

In trying to upgrade things, I’ve found that all the later builds of lxml cause a DLL problem through apache. For example, all of these builds (from pipy) cause the problem:

 

lxml-2.2.8-py2.6-win32.egg

lxml-2.2.8-py2.7-win32.egg

lxml-2.2beta1-py2.6-win32.egg

lxml-2.3beta1-py2.6-win32.egg

lxml-2.3beta1-py2.7-win32.egg

 

(Note that there are no static win32 builds available for 2.2.5-2.2.7, or I can’t find them)

 

The error thrown in the Apache logs is:

 

mod_wsgi (pid=4812): Target WSGI script 'C:/wsgi/handler.py' cannot be loaded as Python module.

 mod_wsgi (pid=4812): Exception occurred processing WSGI script 'C:/wsgi/handler.py'.

 Traceback (most recent call last):

   File "C:/wsgi/handler.py", line 2, in <module>

     from lxml import etree

 ImportError: DLL load failed: The specified module could not be found.

 

The same file works in Python 2.6 if lxml 2.2.4 is installed, but fails for any other higher version of lxml (either in python 2.6 or 2.7).  I’ve been able to trace the problem down to the builds not being able to find the msvcr90.dll file properly. I’ve tried modifying path variables and other changes, but can’t figure out what the problem is. A couple of other things to note:

 

-          Using just “import lxml” doesn’t cause the error, just “from lxml import etree”

-          The problem only occurs through Apache. If I write a script that references etree and call it through the command line, the problem doesn’t occur.

 

Does anyone know what I need to do? What changed after the 2.2.4 lxml builds?

 

Thanks for any help you can give.

Scott Smith