[lxml-dev] Segfault and bus error when importing lxml.html.clean after importing webbrowser
Stefan Behnel
stefan_ml at behnel.de
Sat Mar 1 17:06:01 CET 2008
Hi,
Jon Rosebaugh wrote:
> I was trying to use lxml.html.clean to sanitize comments in my blog.
> Unfortunately, although I can import and use it in a standalone
> console session, it fails within the webapp. Sometimes it segfaults,
> and sometimes it's a bus error instead.
> After going through all the imports to see what _they_ imported, I
> finally tracked down a minimal example that can cause the problem:
>
> import webbrowser
> import lxml.html.clean
>
> If I reverse the order of imports, everything works fine, so for the
> moment I've worked around it by making sure that lxml.html.clean is
> imported the very first thing.
The problem has been investigated. Apparently, importing the webbrowser module
can dynamically load the libxml2 library. As only lxml was built against the
updated libraries, this first import will load the older system libraries,
which then conflict with the libraries that lxml requires.
https://bugs.launchpad.net/lxml/+bug/197243
This problem is due to a misconfigured system that uses conflicting library
versions, so there is nothing lxml can do here.
Stefan
More information about the lxml-dev
mailing list