May-26-2020, 05:12 PM
Hello,
I'm getting started with pykml to read/edit KML files, and am stuck right at the beginning with this error:
Thank you.
I'm getting started with pykml to read/edit KML files, and am stuck right at the beginning with this error:
import lxml
from pykml import parser
"""
dummy.kml:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>KML Samples</name>
<open>1</open>
etc.
"""
doc=None
with open('dummy.kml') as f:
doc = parser.parse(f)
print(doc.Document.name)
"""
d:\>Read.KML.py
Traceback (most recent call last):
File "D:\Read.KML.py", line 15, in <module>
print(doc.Document.name)
AttributeError: 'lxml.etree._ElementTree' object has no attribute 'Document'
"""Am I missing something to keep pykml/lxml happy?Thank you.
