[lxml-dev] Segfault and bus error when importing lxml.html.clean after importing webbrowser
Stefan Behnel
stefan_ml at behnel.de
Sat Feb 2 07:34:57 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.
>
> I have lxml compiled from the 2.0 tgz from the site, libxml2 2.6.31
> and libxslt 1.1.22 installed via macports (both the latest versions
> macports has), Cython 0.9.6.11 installed, and I'm using Python 2.5.1
> as downloaded from python.org for OS X.
Could you please try two things:
- uninstall Cython (you do not need it to build from release sources) or make
sure it is at least 0.9.6.11b (with a 'b'), not only 0.9.6.11, which has bugs
- set DYLD_LIBRARY_PATH as explained here:
http://codespeak.net/lxml/build.html#providing-newer-library-versions-on-mac-os-x
If that doesn't work, try building statically to make sure MacOS-X gets your
libs right (which you definitely want for a production environment).
Stefan
More information about the lxml-dev
mailing list