[lxml-dev] Python crash with lxml use with multi-thread

Hi I am using lxml (just updated to version 1.3.6) on python 2.5, on a windows XP machine. I have a wrapper class for an XML file, and worked fine until I used it on several threads. At that moment it will crash. The piece of code I have it : projectNode = self.dom.xpath('//Project[@Code="%s"]' %projectCode)[0] logger.debug("here") previewsTask = self.dom.xpath('//Task[@Code="%s"]' % taskData.xml_Code)[0] logger.debug("here") projectNode.replace(previewsTask, taskData.dom) #projectNode.remove(previewsTask) #projectNode.append(taskData.dom) logger.debug("here") self.save() logger.debug("here") return None The loggin is to know the last line to be called . The last log msg is written, but the one right after the call to this function is not, that makes me think the crash is on the return. There should be no problem of thread safety, since I am using locks. The crash seems to be on the return, and The calling sequence is : thread 1 : append a node to xml and save thread 2 : replaces node and save (the piece of code above) At this moment it crash python ! Any idea of the problem ? Thanks in advance Pedro Cardoso

Pedro Cardoso wrote:
Have you read the FAQ section on threading? http://codespeak.net/lxml/dev/FAQ.html#id1 Stefan

Pedro Cardoso wrote:
Have you read the FAQ section on threading? http://codespeak.net/lxml/dev/FAQ.html#id1 Stefan
participants (2)
-
Pedro Cardoso
-
Stefan Behnel