[Solved] Button Input Callback Error

Hi, I am enjoying Dash, I have spent hundreds of hours playing with it. I am designing a highly interactive 20 page report. :slight_smile:

This is the first stumbling block:

app.callback(
    dash.dependencies.Output('store_values', 'children'),
     [dash.dependencies.Input('button_versus', 'n_clicks')])
def display_content(clicks):

    return json.dump({"nom":clicks}) 
  1. Store value is a hidden div.
  2. Button is created on call - so it does exist

With output error:

Traceback (most recent call last):
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1997, in call
return self.wsgi_app(environ, start_response)
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1985, in wsgi_app
response = self.handle_exception(e)
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/_compat.py”, line 33, in reraise
raise value
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/flask/app.py”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/Users/dereksnow/anaconda/envs/py36/lib/python3.6/site-packages/dash/dash.py”, line 551, in dispatch
return self.callback_map[target_id]'callback’
KeyError: ‘callback’

I just want to know whether you guys know what is up here, I have tried everything for the whole day. I feel like I know dash on the back of my hand, but can’t wrap my head around this one.

Not sure, but I get basically the same error when I forget the @ in front of app.callback…
so it might be just that?!

3 Likes

You are a genius mate! - If anyone else has experienced this error, lets give this a thumbs up to add it to the error output. Cheers :wink:

2 Likes