Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpslogger: catch broken xml file error #356

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

purarue
Copy link
Contributor

@purarue purarue commented Dec 3, 2023

File "/home/sean/.local/lib/python3.11/site-packages/gpxpy/parser.py", line 146, in parse
    raise mod_gpx.GPXXMLSyntaxException('Error parsing XML: %s' % str(e), e)
gpxpy.gpx.GPXXMLSyntaxException: Error parsing XML: Extra content at the end of the document, line 39, column 22 (<string>, line 39)

not sure exactly what the cause for it is, but sometimes if my laptop loses power (so it crashes) it adds a bunch of weird EOF characters to the end of the file, and this ends up breaking the parser.

I can manually fix that, just thought Id prevent any broken XML files from crashing the parser.

@karlicoss
Copy link
Owner

Sorry, missed the notification! I guess ideally we'd make it yield Exception or something instead, but for now doesn't hurt to merge as is. Thanks!

@karlicoss karlicoss merged commit 224ba52 into karlicoss:master Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants