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

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

Closed
wrohdewald opened this issue Mar 10, 2023 · 1 comment

Comments

@wrohdewald
Copy link
Contributor

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

@lbenedix
Copy link
Contributor

lbenedix commented Jul 2, 2023

#262

@tkrajina tkrajina closed this as completed Jul 8, 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

No branches or pull requests

3 participants