tkrajina/gpxpy

NameError: free variable 'from_start_to_end' referenced before assignment in enclosing scope

wrohdewald opened this issue · 1 comments

gpxpy 1.5.0

This is a track with no times. Starting and ending point are the same.
Giving from_start_to_end a default value of None helps avoid the NameError but places the entire time difference between the last two points.

I a sorry but for some time coming I have very little time for further investigation.

File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 2570, in add_missing_times self.add_missing_data(get_data_function=lambda point: point.time, File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 2539, in add_missing_data track.add_missing_data(get_data_function, add_missing_function) File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 1736, in add_missing_data track_segment.add_missing_data(get_data_function, add_missing_function) File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 1084, in add_missing_data distances_ratios = self._get_interval_distances_ratios(interval, start_point, track_point) File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 1112, in _get_interval_distances_ratios return [(distance / from_start_to_end) if from_start_to_end else 0 File "/usr/local/lib/python3.9/dist-packages/gpxpy/gpx.py", line 1112, in <listcomp> return [(distance / from_start_to_end) if from_start_to_end else 0 NameError: free variable 'from_start_to_end' referenced before assignment in enclosing scope