artiest
artiest

Reputation: 592

The input argument `input.value` must be a list or tuple of `dash.dependencies.Input`s. dash

i'm trying to learn dash i'm at the third tutorial but it raise this error whenever i run the file(python app.py)

dash.exceptions.IncorrectTypeException: The input argument input.value must be a list or tuple of dash.dependencies.Inputs.

this is the code i'm running :

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
   html.H6("Change the value in the text box to see callbacks in action!"),
   html.Div(["Input: ",
          dcc.Input(id='input', value='initial value', type='text')]),
   html.Br(),
   html.Div(id='output'),

])


@app.callback(
    Output(component_id='output', component_property='children'),
    Input(component_id='input', component_property='value')
)
def update_output_div(input_value):
    return 'Output: {}'.format(input_value)


if __name__ == '__main__':
    app.run_server(debug=True)

please what is wrong with the code?! even i tried to copy and paste the code still raise the same error thank you ..

versions

python = 3.6

dash=1.7.0

dash-core-components=1.6.0

dash-html-components=1.0.2

Upvotes: 1

Views: 3786

Answers (1)

coralvanda
coralvanda

Reputation: 6596

You need to wrap your inputs in a list, like this:

@app.callback(
    Output(component_id='output', component_property='children'),
    [Input(component_id='input', component_property='value')]
)
def update_output_div(input_value):
    return 'Output: {}'.format(input_value)

Upvotes: 3

Related Questions