[lxml-dev] HELP: Some truncated output and malloc errors
Hi all. I'm having some problems perhaps related to usage, perhaps not. Below is a script: =================================== import os, lxml.etree delivdir = os.path.split(os.path.abspath(__file__))[0][:-3] class Test: def __init__ (self): # Load the compiler-blank and compiler docs compilerblankdoc = loadfile("lib/blank-compiled.xml") compilerdoc = loadfile("lib/compiler.xsl") # Compile the compiler-blank into our style doc for repeated use compilerstyle = lxml.etree.XSLT(compilerdoc) self.compiledstyle = compilerstyle.apply(compilerblankdoc) self.processor = lxml.etree.XSLT(self.compiledstyle) def transformToString(self, inputdoc): """Run the compiled stylesheet against the input doc""" result = self.processor.apply(inputdoc) return self.processor.tostring(result).encode("utf-8") def loadfile (fn): """Load a file and return an xml dom""" f = open(delivdir + fn, "r") doc = lxml.etree.parse(f) f.close() del f return doc def main (): """Used for command-line debugging""" d = Test() sampledoc = loadfile("tests/sampledoc1.xml") result = d.transformToString(sampledoc) print result return d if __name__ == "__main__": main() =================================== When I run it, the string that is produced (in the main() function) seems very truncated relative to inspection by walking the nodes manually. Also, I get a bunch of: python(8231) malloc: *** Deallocation of a pointer not malloced: 0x1845235; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug python(8231) malloc: *** Deallocation of a pointer not malloced: 0x1845117; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug etc. When I run the same stylesheet and transform via xsltproc from the command line, all works ok. --Paul
Hoi, Paul Everitt wrote:
When I run the same stylesheet and transform via xsltproc from the command line, all works ok.
Could you supply us with an XML source and stylesheet where it goes wrong? This makes it easier for people to reproduce your test case. Those malloc errors are scary. Regards, Martijn
On May 6, 2005, at 5:37 PM, Martijn Faassen wrote:
Hoi,
Paul Everitt wrote:
When I run the same stylesheet and transform via xsltproc from the command line, all works ok.
Could you supply us with an XML source and stylesheet where it goes wrong? This makes it easier for people to reproduce your test case.
Those malloc errors are scary.
The part that I reported as truncated output was traced to the exslt:node-set not behaving correctly. The malloc messages only appeared on OS X, not when I ran it on Linux. Still interested in a test case? --Paul
participants (2)
-
Martijn Faassen
-
Paul Everitt