i've ben stuck for weeks already with this little problem. Neither of these links, as well as many other won't help: Parsing dtd file with lxml library (python) Error parsing a DTD using lxml get errors when import lxml.etree to python
The problem is: When I try to parse any dtd-file with lxml I get this message:
Traceback (most recent call last): File "/Users/benutzer/Documents/tester.py", line 7, in dtd=etree.DTD(dtd_path) File "src/lxml/dtd.pxi", line 294, in lxml.etree.DTD.init (src/lxml/lxml.etree.c:186845) lxml.etree.DTDParseError: error parsing DTD
The example of the dtd-file is taken from oxygen samples list, but alongside other files it cannot be parsed. I'm using MacBook Pro and Python 3.4 and interestingly a colleague of mine does not get this message and is apparently able to parse stuff with lxml. Everything works fine on Windows-laptops as well. So I assume the problem is somewhere within my laptop. If any of you has any idea where it might lurk it would be great. Here is the example of the code I'm using on this one:
import lxml
from lxml import etree
import os
import io
from io import StringIO
dtd_path=os.path.join(os.path.dirname(os.path.realpath(__file__)), r'personal.dtd')
dtd=etree.DTD(dtd_path)
If you need more info from me just ask. Thanks in advance!
P.S. Now as I've followed the commentary of MattDMo I am able to parse with this piece of code without any trouble, but when I insert it in the larger code the error comes back. Now the path is seemingly ok. Should I include that part od the code where I use these lines?