Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Dash callbacks issues - Traceback (most recent call last)

Hi Community,

I am new to Dash and making my way to learn it to be able to build dashboards. With the callbacks, I have been facing some issue. I am simply trying to run the app.py for the basic callbacks code given on the learning site - Basic Callbacks | Dash for Python Documentation | Plotly

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

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

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

server = app.server

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

])


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


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

However, when I run it. I get the below error.

Traceback (most recent call last):
  File "app.py", line 24, in <module>
    Input(component_id='my-input', component_property='value')
  File "C:\Users\pc\mydash\lib\site-packages\dash\dash.py", line 958, in callback
    callback_id = self._insert_callback(output, inputs, state, prevent_initial_call)
  File "C:\Users\pc\mydash\lib\site-packages\dash\dash.py", line 831, in _insert_callback
    _validate.validate_callback(output, inputs, state)
  File "C:\Users\pc\mydash\lib\site-packages\dash\_validate.py", line 16, in validate_callback
    validate_callback_args(args, cls)
  File "C:\Users\pc\mydash\lib\site-packages\dash\_validate.py", line 27, in validate_callback_args
    name.lower(), str(args), name
dash.exceptions.IncorrectTypeException: The input argument `my-input.value` must be a list or tuple of
`dash.dependencies.Input`s.

Could you please help me with this issue? Thank you in advance.

Hi aman.bhardwaj,
I had copy and paste the code you are using and its run without any problem.
The problem you are facing is related with the Input, for some reason I don’t understand the:

from dash.dependencies import Input, Output, State, ClientsideFunction

It’s not working properly in your enviroment.

Hi @aman.bhardwaj

Try upgrading to the latest version of Dash

2 Likes

Thank you, it was a version issue that is now solved.

1 Like