Reputation: 23
I've made a Streamlit app using python, in which it is possible to drag and drop a gpx file.
import streamlit as st
file = st.file_uploader("Upload a strava file (gpx)", type=["gpx"],accept_multiple_files=False)
However opening the InMemoryUploadedFile with the package gpxpy package isn't possible. Giving me a KeyError: 3655
import gpxpy
gpx = gpxpy.parse(file)
Can someone help me?
Upvotes: 1
Views: 206
Reputation: 2223
Please try:
import streamlit as st
import gpxpy
uploaded_file = st.file_uploader("Upload a strava file (gpx)", type=["gpx"], accept_multiple_files=False)
if uploaded_file is not None:
gpx = gpxpy.parse(uploaded_file)
Please also make sure both streamlit and gpxpy is updated to the latest version and the gpx file is not corrupted
Upvotes: 2