hi, I want to create a multi input by a for loop, but it doesn’t work, and get this error:
IncorrectTypeException: Callback arguments must be Output
, Input
, or State
objects,
optionally wrapped in a list or tuple. We found (possibly after
unwrapping a list or tuple):
“[Input(‘2021-09-01’, ‘value’), Input(‘2021-10-01’, ‘value’), Input(‘2021-11-01’, ‘value’), Input(‘2021-12-01’, ‘value’), Input(‘2022-01-01’, ‘value’), Input(‘2022-02-01’, ‘value’), Input(‘2022-03-01’, ‘value’), Input(‘2022-04-01’, ‘value’), Input(‘2022-05-01’, ‘value’), Input(‘2022-06-01’, ‘value’), Input(‘2022-07-01’, ‘value’), Input(‘2022-08-01’, ‘value’), Input(‘2022-09-01’, ‘value’), Input(‘2022-10-01’, ‘value’), Input(‘2022-11-01’, ‘value’), Input(‘2022-12-01’, ‘value’),]”
The input is already a list but still gets this error.
This is my code:
call_list=[]
scenarioslist=[]
for scenario in pd.date_range(start=next_month, end=next_year_end,freq='MS').date:
call_list.append("Input('"+str(scenario)+"', 'value'),")
scenarioslist.append("'"+str(scenario)+"'")
#call_list.insert(0,"Output('Sensitivity', 'figure'),")
call_list=" ".join(call_list)
call_list = '['+call_list+']'
#call_list.insert(0,"Output('Sensitivity', 'figure'),")
scenarioslist = " ".join(scenarioslist)
print(call_list)
print(scenarioslist)
@app.callback(
Output('Sensitivity', 'figure'),
call_list
)
def update_graph(scenarioslist):
could anyone know the reason and help me plz, many thanks