James McCool
commited on
Commit
·
f9e16b0
1
Parent(s):
5abfd03
Add error handling for contest file upload in app.py
Browse files- Implemented a try-except block to manage potential errors when uploading a contest CSV file.
- Added a warning message to prompt users to upload a valid contest CSV if the upload fails, enhancing user experience and data integrity.
app.py
CHANGED
@@ -124,7 +124,10 @@ with tab1:
|
|
124 |
if 'Contest_file' not in st.session_state:
|
125 |
st.session_state['Contest_upload'] = st.file_uploader("Upload Contest File (CSV or Excel)", type=['csv', 'xlsx', 'xls'])
|
126 |
st.session_state['player_info'], st.session_state['info_maps'] = grab_contest_player_info(db, sport_select, type_var, date_select, contest_name_var, contest_id_map)
|
127 |
-
|
|
|
|
|
|
|
128 |
else:
|
129 |
pass
|
130 |
|
|
|
124 |
if 'Contest_file' not in st.session_state:
|
125 |
st.session_state['Contest_upload'] = st.file_uploader("Upload Contest File (CSV or Excel)", type=['csv', 'xlsx', 'xls'])
|
126 |
st.session_state['player_info'], st.session_state['info_maps'] = grab_contest_player_info(db, sport_select, type_var, date_select, contest_name_var, contest_id_map)
|
127 |
+
try:
|
128 |
+
st.session_state['Contest_file'] = pd.read_csv(st.session_state['Contest_upload'])
|
129 |
+
except:
|
130 |
+
st.warning('Please upload a Contest CSV')
|
131 |
else:
|
132 |
pass
|
133 |
|