[lxml-dev] Error with thread

Frédéric Mantegazza mantegazza at ill.fr
Tue Oct 30 09:08:34 CET 2007


Le lundi 29 octobre 2007 17:36, Stefan Behnel a écrit :

> That's a pretty old version, but the general restriction still applies.
> You cannot use an XSLT object in a different thread if it was not created
> in the main thread (that's due to some optimisations in libxslt).

Ok, so I correctly guessed the problem ;o)

> Try preparing the stylesheets in the main thread. Or, if you do not
> control the main thread, consider creating them on the fly and maybe
> caching them in thread local storage.

Mmmm, I can't do that, as:

1) I would have to create the stylesheets every second (I use them to output 
datas during instrument scans, and I have 5 or 6 different stylesheets, 
used for screen output, and different files formats outputs);

2) I can't cache them, as a new thread is created for each new point of the 
scan (Pyro mecanism).

I have to find another solution, by adding some new methods and propagate 
the new params, without creating a new stylesheet.

Thanks,

-- 
   Frédéric


More information about the lxml-dev mailing list