I am puzzled about the following error message, which I got when I ran a familiar script on my new iMac with python3.4 and lxml 3.42.
Traceback (most recent call last):
File "/Users/martinmueller/Dropbox/PycharmProjects/emd/emdFeb2015.py", line 99, in <module>
tree = etree.parse(filename, parser)
File "lxml.etree.pyx", line 3301, in lxml.etree.parse (src/lxml/lxml.etree.c:72453)
File "parser.pxi", line 1791, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:105915)
File "…
[View More]parser.pxi", line 1817, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:106214)
File "parser.pxi", line 1721, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:105213)
File "parser.pxi", line 1122, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:100163)
File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:94286)
File "parser.pxi", line 690, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:95722)
File "parser.pxi", line 620, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:94789)
lxml.etree.XMLSyntaxError: Memory allocation failed, line 13323, column 18
This error occurs after running about 70 texts, each of them between 2 and 4 MB in length. The error is not a function of anything in the text that fails, because the text is processed perfectly when processed separately. IN watching memory allocation for different processes on the Mac Activity monitor, there isn't anything unusual about the memory currently used by Python or Pycharm, which I use.
It would seem from this diagnosis that somehow memory is used up cumulatively in lxml and crosses some threshold after a while. Is it related to an earlier problem where the underlying libxml stores all xml:ids in batch operations? But that led to a noticeable slowdown in operations, whereas here the processing time for each text seems a stable and linear function of its length, until suddenly it collapses.
I'll be grateful for any advice.
[View Less]
Hi,
I'm using Python 2.7 and LXML 2.3.0 (PortablePython distrib).
My custom XSD is importing XHTML Strict 1.0 one.
All XSD have elementFormDefault="qualified".
In my XML instances a default namespace is declared for the custom XSD
elements (such elements are not prefixed). xmlns:xhtml prefix is also
declared on the root start ta.g
I would like all xhtml elements to be prefixed by "xhtml:".
Instead, LXML is just changing the default namespace on each xhtml fragment
root start tag.
In my …
[View More]code, xhtml fragment root elements are created with:
div = etree.Element('{http://...}div')
children elements are added this way:
p = etree.SubElement(div, '{http://...}p')
and then div is added to the custom parent element:
parent.append(div).
What do I miss?
The only (UGLY) workaround I found so far is to create elements this way:
div = etree.Element('xhtml_div')
and then serialize this way:
etree.tostring(root, ...).replace('<xhtml_', '<xhtml:').replace('</xhtml_',
'</xhtml:')
!
Regards,
Olivier.
[View Less]
Hiya,
I guess this is primarily for Stefan but it looks like it's now possible
to get the relevant Python wheels built automatically:
https://packaging.python.org/en/latest/appveyor.html
I wonder if this could be used by lxml? And if so, could I get a Python
3.5 build? ;-) Python 3.5 is due to go to beta soon so I'd like to have it
my tox configuration, now that I've more or less worked out how to get tox
working with lxml on Windows.
Charlie
--
Charlie Clark
Managing Director
…
[View More]Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
[View Less]