[lxml-dev] Error with thread
Frédéric Mantegazza
mantegazza at ill.fr
Tue Oct 30 08:33:30 CET 2007
Le lundi 29 octobre 2007 17:02, Frédéric Mantegazza a écrit :
> I have a problem with a XSLT filter:
>
> Traceback (most recent call last):
> File "/home/pymad/PyMAD/server/macros/freeScan.py", line 247, in
> doAction DataManager().newScanPoint(numPoint, 'NSF')
> File "/home/pymad/PyMAD/server/managers/dataManager.py", line 253, in
> newScanPoint
> self.__scan.setPoint(numPoint, numPal)
> File "/home/pymad/PyMAD/server/data/scanData.py", line 221, in setPoint
> self.__serialize()
> File "/home/pymad/PyMAD/server/data/scanData.py", line 196, in
> __serialize filter_.dumpScan(self.__tree, self.__scanBaseName)
> File "/home/pymad/PyMAD/server/data/dataFilters.py", line 122, in
> dumpScan result = self.__xslFilter.apply(tree, fileName="'%s'" %
> baseName) File "xslt.pxi", line 450, in etree.XSLT.apply
> File "xslt.pxi", line 356, in etree.XSLT.__call__
> RuntimeError: stylesheet is not usable in this thread
>
> This error ocurs on a machine, and not on another, which has the same
> install (debian etch, lxml 1.1.1).
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). 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.
Is this analyse correct? Is there a workarround ?
--
Frédéric
More information about the lxml-dev
mailing list