I want to convert AsciiMath to MathML. I just want to get the XML content but I need not to display on browser.
So, I have installed MathDOM 0.8, lxml 2.3, pyparsing 1.5.6. I have not installed PyXML because MathDOM uses PyXML or lxml, and pyparsing.
I then run three examples in MathDOM directory such as dom.py, infix.py and ldom.python.
dom.py and infix.py output an error: ImportError: No module named Element
Otherwise, ldom.py outputs other error: AttributeError: 'NoneType' object has no attribute 'setParseAction'
I have also tried to install PyXML but I could not run the examples, too.
Please help me.
Thanks.
MathDOM 0.8 (which installs module mathml
) works only with the older pyparsing 1.4.2.
Here's a way to override pyparsing
with the older version, affecting mathml
only. Tested on Python 2.7 on Windows 7:
pyparsing.py
(version 1.4.2 according to the SVN commit messages, though there are no tags in the repository) and save it in the mathdom-0.8/mathml
folder that you extracted. This will take precedence over the installed pyparsing
, but only for the mathml
package.mathdom-0.8/
and install (e.g. python setup.py install
or pip install .
, perhaps appending --prefix=$HOME/usr
or somesuch).Test with python -c "from mathml import termparser"
; it should succeed where it previously failed with AttributeError: 'NoneType' object has no attribute 'setParseAction'
.
You can also verify that python -c "from mathml import pyparsing; print pyparsing.__version__"
prints 1.4.2
, whereas python -c "import pyparsing; print pyparsing.__version__"
prints 1.5.6
.
Hope this helps!