So I’m getting several similar callback errors but the functionality on the webapp still works as intended. Im still trying to remove those error messages though:
Error message: TypeError: only list-like objects are allowed to be passed to isin(), you passed a [NoneType]
So this is simple. In the following callback the fourth input is None when the app refreshes, or another dropdown is blank.
When I populate that other filter, i dont get this error message.
# populate time filter dropdown
@app.callback(
Output('time-filter', 'options'),
[Input('datasets', 'data'),
Input('sim-filter', 'value'),
Input('source-filter', 'value'),
Input('event-filter', 'value')]
)
def update_time_filter(datasets_store, selected_sim, selected_source, selected_event):
# FIXME: NoneType error in if statement
datasets = json.loads(datasets_store)
df_ec = pd.read_json(datasets['df_ec'], orient='split')
df_ec = df_ec[(df_ec.SimId == selected_sim)
& (df_ec.Source == selected_source)
& (df_ec.EventType.isin(selected_event))]
times = [{'label': str(simtime), 'value': simtime} for simtime in sorted(df_ec.SimulationTime.unique())]
times.insert(0, {'label': 'Select all', 'value': 'all_values'})
return times
So I tried several things:
If statement with dash.no_update, dash.exceptions. PreventUpdate, pass, return None and by doing any of these things, my dropdown callback doesnt work anymore.