Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

dash.exceptions.InvalidCallbackReturnValue: Invalid number of output values Expected 2, got 1

$
0
0

I have a call back with multiple output values inside a list. When I deploy the app and check the logs, it throws a dash exception.

app.layout = html.Div([

    # header
    html.Div([

    # For pdf downloads
    dash_extensions.Download(id="download"),

    dcc.Location(id="url"),
    html.Div(id="page-content"),

])

Callback

@app.callback([
               Output('page-content', 'children'),
               Output('download', 'data')
              ],
              [Input('url', 'pathname')]
             )
def display_content(page_name):

    # Pages and Links

    if page_name == 'history':
        return [history.layout(), dash.no_update]

    else:
        return ['404 Error', dash.no_update]

Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 1050, in dispatch
response.set_data(func(*args, outputs_list=outputs_list))
File "/app/.heroku/python/lib/python3.6/site-packages/dash/dash.py", line 995, in add_context
_validate.validate_multi_return(output_spec, output_value, callback_id)
File "/app/.heroku/python/lib/python3.6/site-packages/dash/_validate.py", line 126, in validate_multi_return
callback_id, len(outputs_list), len(output_value)
172.17.0.19 - - [03/Sep/2020:06:03:32 +0000] "POST /dash-app/_dash-update-component HTTP/1.1" 500 69 "https://example.com/dash-app" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"

dash.exceptions.InvalidCallbackReturnValue: Invalid number of output values for ..page-content.children...download.data...

7 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images