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

Bug: free variable 'from_start_to_end' referenced before assignment in enclosing scope #231

Closed
martinlehoux opened this issue Apr 20, 2021 · 1 comment

Comments

@martinlehoux
Copy link

GPXpy: 1.4.2
Python: 3.8.3

Issue

I ran the following line:

gpx = gpxpy.parse(self.source_file.open())

and encountered the following issue:

free variable 'from_start_to_end' referenced before assignment in enclosing scope

Ideas

The following line seems to have an issue (at least I ran into one):

return [(distance / from_start_to_end) if from_start_to_end else 0

The few lines above do not define from_start_to_end when dist is falsy

dist = interval[-1].distance_3d(end)
if dist:
    from_start_to_end = distances[-1] + dist

Maybe default to 0 ?

@martinlehoux
Copy link
Author

Here is the failing track, I can open it successfully in gnome-maps
track.zip

@martinlehoux martinlehoux closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2022
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

1 participant