Getting Error Selectbox Value has invalid type: NoneType
When setting Index = None
The code works fine on the desktop, but when deploying it, This error comes up, How to solve it?
selection = st.selectbox('Transactions:',options=['Payments_Applications','Upload_File'],index=None,placeholder='Select an Option')
if selection == 'Payments_Applications':
st.text('Generate Data Frame to work with by Selecting the Date Ranges you want to process')
elif selection == 'Upload_File':
col1,col2 = st.columns(2)
with col1:
file_uploaded = st.file_uploader('Upload Template file with payments and invoices details')
raise StreamlitAPIException(
streamlit.errors.StreamlitAPIException: Selectbox Value has invalid type: NoneType
selection = st.selectbox(‘Transactions:’, options=[‘Payments_Applications’, ‘Upload_File’], index=None, placeholder=‘Select an Option’)
if selection is not None:
if selection == ‘Payments_Applications’:
st.text(‘Generate Data Frame to work with by Selecting the Date Ranges you want to process’)
elif selection == ‘Upload_File’:
col1, col2 = st.columns(2)
with col1:
file_uploaded = st.file_uploader(‘Upload Template file with payments and invoices details’)
else:
st.warning(‘Please select an option.’)
Hi @Sahil_Gupta. Here is the small suggestion that to use multiple comment type for attaching any code to the user. Where the user can easily copy the code. Like this:-
selection = st.selectbox('Transactions:', options=['Payments_Applications', 'Upload_File'], index=None, placeholder='Select an Option')
if selection is not None:
if selection == 'Payments_Applications':
st.text('Generate Data Frame to work with by Selecting the Date Ranges you want to process')
elif selection == 'Upload_File':
col1, col2 = st.columns(2)
with col1:
file_uploaded = st.file_uploader('Upload Template file with payments and invoices details')
else:
st.warning('Please select an option.')