File upload error

Hi, while creating an application to read and visualise excel files for my students I am facing an issue of

ValueError: Invalid file path or buffer object type: <class ‘NoneType’>


The traceback error being;

However, after the file upload the application does not show any error

Please help in debugging the application to make the home screen clear
Thanks,

It look like you need to add a condition :slight_smile:

if upload_document is not None:
 #YOURCODE
else:
  st.write('Please provide a file')

Add a guard condition

if uploaded_file := st.file_uploader(...):
    dataframe = pd.read_excel(uploaded_file, ...)
    ...
else:
    st.warning("Upload file to continue")
2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.