Repository navigation
Fix GPX file loading errors and quantile extraction bug - #4
Draft
pascal2802 wants to merge 9 commits into
Draft
pascal2802 wants to merge 9 commits into
pascal2802 wants to merge 9 commits into
Conversation
- Changed file opening mode from text ('r') to binary ('rb') in Base.py and main.py
to properly parse GPX files which are XML format
- Fixed temporary file handling in app.py for both example files and user uploads:
- Separated file content reading from temporary file creation
- Added explicit mode='wb' for temporary files
- Properly closed temporary files before use
- Fixed variable shadowing issue where uploaded_file was being overwritten
These changes resolve the errors reported in PR #2:
- Error when using default GPX example files
- Error when uploading GPX files via the upload button
The root cause was that gpxpy.parse() requires a file opened in binary mode,
not text mode, and the temporary file handling had logic errors.
- Fixed bug where computeQuantilePerComponent returns a Sample, and [0] returns a Point - Need to use [0][0] to extract the float value from the Point - This was causing TypeError when comparing lower <= mean_speed <= upper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the errors reported in PR #2:
Additional fix:
Root cause: GPX files (XML format) must be opened in binary mode ('rb'), not text mode ('r'). Also fixed temporary file handling logic in the Streamlit app.
Changes: