I was wondering if someone can explain the odd behavior in the file uploader. It fails with following error
TypeError: Expected file path name or file-like object, got <class ‘bytes’> type
df: pandas.DataFrame = pandas.read_csv(filepath_or_buffer=upload_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oddly If I change to accept_multiple_files=True, it works fine !.
Python 3.11.8
streamlit 1.32.2
pandas 2.2.0
import streamlit as st
import pandas
uploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=False)
for upload_file in uploaded_files:
df: pandas.DataFrame = pandas.read_csv(
filepath_or_buffer=upload_file, delimiter=",", header=None
)