James McCool commited on
Commit
a4e6673
·
1 Parent(s): cefd40a

Improve error handling for CSV file names in app.py: add a try-except block to ensure robust retrieval of names from session state, enhancing application stability and user experience.

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -172,7 +172,10 @@ with tab1:
172
  # Initialize projections_df in session state if it doesn't exist
173
  # Get unique names from portfolio
174
  portfolio_names = get_portfolio_names(st.session_state['portfolio'])
175
- csv_names = st.session_state['csv_file']['Name'].tolist()
 
 
 
176
  projection_names = projections['player_names'].tolist()
177
 
178
  # Create match dictionary for portfolio names to projection names
@@ -784,7 +787,7 @@ with tab2:
784
  with col1:
785
  if st.button('Reset Portfolio', key='reset_port'):
786
  del st.session_state['working_frame']
787
-
788
  with col2:
789
  Contest_Size = st.number_input("Enter Contest Size", value=25000, min_value=1, step=1)
790
 
 
172
  # Initialize projections_df in session state if it doesn't exist
173
  # Get unique names from portfolio
174
  portfolio_names = get_portfolio_names(st.session_state['portfolio'])
175
+ try:
176
+ csv_names = st.session_state['csv_file']['Name'].tolist()
177
+ except:
178
+ csv_names = st.session_state['csv_file']['Nickname'].tolist()
179
  projection_names = projections['player_names'].tolist()
180
 
181
  # Create match dictionary for portfolio names to projection names
 
787
  with col1:
788
  if st.button('Reset Portfolio', key='reset_port'):
789
  del st.session_state['working_frame']
790
+
791
  with col2:
792
  Contest_Size = st.number_input("Enter Contest Size", value=25000, min_value=1, step=1)
793