Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] error reporting callback definition errors #791

Closed
alexcjohnson opened this issue Jun 24, 2019 · 3 comments
Closed

[BUG] error reporting callback definition errors #791

alexcjohnson opened this issue Jun 24, 2019 · 3 comments
Assignees
Labels
regression this used to work
Milestone

Comments

@alexcjohnson
Copy link
Collaborator

From https://community.plot.ly/t/multiple-callback-error/24981

Probably came from removing the MutableMapping mixin #753

This app has bad IDs in the second callback:

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

series = [str(i) for i in range(20)]

all_options = {
    'group_1': series[1:5],
    'group_2': series[6:10],
    'group_3': series[11:-1],
}

app = dash.Dash()

app.layout = html.Div(children=[
    html.P([
        html.Label('Choose a group:'),
        dcc.Dropdown(
            id='groups_dropdown',
            options=[{'label': k, 'value': k} for k in all_options.keys()],
            value='group_1'
        )
    ], style=dict(width='400px')),

    html.P([
        html.Label('Choose a series:'),
        dcc.Dropdown(id='series_dropdown')
    ], style=dict(width='400px')),
])


@app.callback(Output('series_dropdown', 'options'),
              [Input('groups_dropdown', 'value')])
def set_series_options(selected_group):
    return [{'label': i, 'value': i} for i in all_options[selected_group]]


@app.callback(Output('series-dropdown', 'value'),
              [Input('series-dropdown', 'options')])
def set_series_value(available_options):
    return available_options[0]['value']


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

But the error is broken:

Traceback (most recent call last):
  File "f.py", line 40, in <module>
    [Input('series-dropdown', 'options')])
  File "/Users/alex/plotly/dash/dash/dash.py", line 1156, in callback
    self._validate_callback(output, inputs, state)
  File "/Users/alex/plotly/dash/dash/dash.py", line 865, in _validate_callback
    list(layout.keys()) + (
AttributeError: 'Div' object has no attribute 'keys'
@shoegazerstella
Copy link

Hi,
I am having the same issue. These are the libraries versions if it can help:

dash
dash-html-components==0.13.4
dash-core-components==0.42.1
dash-daq
dash-table==3.1.11

Does this depend only on the new version of dash? Or maybe the other components are related?

@alexcjohnson
Copy link
Collaborator Author

@shoegazerstella if the issue is what I think it is, it's specific to dash 1.0.0 via #753 - I expect we'll be able to fix this for the next release.

@Buyannemekh
Copy link

Hi, I'm running into the same problem. I'd like to follow up if this has fixed yet? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression this used to work
Projects
None yet
Development

No branches or pull requests

4 participants