diff --git a/mapillary_tools/geotag/geotag_images_from_gpx_file.py b/mapillary_tools/geotag/geotag_images_from_gpx_file.py index 23337f8e4..f563a6d3e 100644 --- a/mapillary_tools/geotag/geotag_images_from_gpx_file.py +++ b/mapillary_tools/geotag/geotag_images_from_gpx_file.py @@ -25,7 +25,13 @@ def __init__( num_processes: T.Optional[int] = None, ): super().__init__() - tracks = parse_gpx(source_path) + try: + tracks = parse_gpx(source_path) + except Exception as ex: + raise RuntimeError( + f"Error parsing GPX {source_path}: {ex.__class__.__name__}: {ex}" + ) + if 1 < len(tracks): LOG.warning( "Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation", diff --git a/mapillary_tools/video_data_extraction/extractors/gpx_parser.py b/mapillary_tools/video_data_extraction/extractors/gpx_parser.py index c864ad382..ce3287cd9 100644 --- a/mapillary_tools/video_data_extraction/extractors/gpx_parser.py +++ b/mapillary_tools/video_data_extraction/extractors/gpx_parser.py @@ -20,7 +20,13 @@ def extract_points(self) -> T.Sequence[geo.Point]: if not path: return [] - gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path) + try: + gpx_tracks = geotag_images_from_gpx_file.parse_gpx(path) + except Exception as ex: + raise RuntimeError( + f"Error parsing GPX {path}: {ex.__class__.__name__}: {ex}" + ) + if 1 < len(gpx_tracks): LOG.warning( "Found %s tracks in the GPX file %s. Will merge points in all the tracks as a single track for interpolation",