[lxml-dev] Error with thread

Stefan Behnel stefan_ml at behnel.de
Tue Oct 30 09:24:37 CET 2007


Salut,

Frédéric Mantegazza wrote:
> Ok, I think I found the problem, but not the solution. I'm using lxml in a 
> client/server app, based on Pyro. The first time I instanciate all my XSLT 
> filters, I'm in a the main thread. Then, I can use them in other threads, 
> and it works fine.
> 
> But I have some commands to create a new session in the DataManger, and I 
> then re-instanciate all XSLT filters (with different params).

If with "params" you mean XSLT parameters, you can pass these at call time,
you do not need to reinstantiate the XSLT for that.


> But here, I'm 
> not in the main thread anymore! And it seems that if XSLT filters are 
> instanciated in threads, they can't be used in other thread.

Correct. As I said, a work-around would be to either create them on the fly or
cache the XSLT objects in thread-local storage and reuse them from there.

Stefan


More information about the lxml-dev mailing list