#open file
with open('test.gpx', 'r') as gpx_file:
gpx = gpxpy.parse(gpx_file)
print(gpx.extensions)
print(gpx.metadata_extensions)
# save to a file
with open('output.gpx', 'w') as f:
f.write(gpx.to_xml())
#open written file again
with open('output.gpx', 'r') as gpx_file:
gpx_copy = gpxpy.parse(gpx_file) # GPXXMLSyntaxException: Error parsing XML: not well-formed (invalid token): line 7, column 12
With the above attached code, when I read a file and save it, I cannot retrieve it again until I remove the extension. Getting either the extensions or the metadata extensions returns a blank list. I cannot seem to access the extension to remedy the problem.
For reference, this is the original GPX file (which can be opened)
With the above attached code, when I read a file and save it, I cannot retrieve it again until I remove the extension. Getting either the extensions or the metadata extensions returns a blank list. I cannot seem to access the extension to remedy the problem.
For reference, this is the original GPX file (which can be opened)
And this is the written file