tkrajina / gpxpy

gpx-py is a python GPX parser. GPX (GPS eXchange Format) is an XML based file format for GPS tracks.
Apache License 2.0
989 stars 223 forks source link

Huge Option #110

Closed Segelzwerg closed 5 years ago

Segelzwerg commented 6 years ago

Hi folks,

I get an exception:

Excessive depth in document: 256 use XML_PARSE_HUGE option, line 769, column 5 (, line 769) At first I thought there was an issue with special chars in the file name, but even with clean file names some files raises that error.

Do you need anything else?

Cheers, Marcel

tkrajina commented 6 years ago

Two ideas. First of all you are using lxml. Try uninstalling it and gpxpy will fallback to the default parser and it should work (but it will be slow).

The lxml parsing at https://github.com/tkrajina/gpxpy/blob/master/gpxpy/parser.py#L46 should include the fix described here https://stackoverflow.com/questions/11850345/using-python-lxml-etree-for-huge-xml-files .

Note, if somebody plan to fix this in a pull request, do it from dev, since the code there changed from the current master.