Create pie chart error

Hello,
I updated my database yesterday and on my test version the application doesn’t work regarding the pie chart.When I try the app I get the following error.
Do you guys have any idea,for what should I check in the database or in the whole app?


Traceback (most recent call last):
  File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\dash\dash.py", line 1017, in add_context
    output_value = func(*args, **kwargs)  # %% callback invoked %%
TypeError: create_pie_chart() takes 2 positional arguments but 3 were given

This is my create pie chart function

def create_pie_chart(query_output, db_name):
    if not query_output:
        return go.Figure(data=None)
    query_output = pd.read_json(query_output, orient='split')
    query_output = process_for_pie_chart(query_output)

    # Scrap Codes
    query_string = mssql_queries.build_db_query_string_defect_descriptions()
    records = mssql_conn.execute_without_params(query_string, str(db_name))
    scrap_codes = pd.DataFrame.from_records(records)
    scrap_codes.columns = ["ID", "DefectDescription"]
    query_output = query_output.join(scrap_codes, lsuffix="FaultID", rsuffix="ID")

    layout = go.Layout(
    #title='Consumer Financial Protection Bureau: Consumer Complaints',
    #titlefont=dict(
    #    color='rgb(128,128,128)',
    #    family='Balto, sans-serif',
    #    size=12
    #),
    font=go.Font(
        color='rgb(128,128,128)',
        family='Balto, sans-serif',
        size=12
    ),
    #width=1770,
    #height=800,
    paper_bgcolor='rgb(240, 240, 240)',
    plot_bgcolor='rgb(240, 240, 240)',
    )
    fig = go.Figure(data=[go.Pie(labels=query_output["DefectDescription"], values=query_output["ErrorCount"])], layout=layout)
    #fig = go.Figure(data=[go.Pie(labels=query_output["FaultID"], values=query_output["ErrorCount"])], layout=layout)
    return fig, query_output.to_json(date_format='iso', orient='split')

Try looking where you call the create_pie_chart function.

There is probably one like: create_pie_chart(a,b,c) with three positional arguemnts, rather than create_pie_chart(a,b) with two positional arguements.

I removed the language from create_pie_chart,but now I have an error saying:
Do you have any hints for it? Do you want me to paste the whole code?

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1513, in full_dispatch_request

    rv = self.dispatch_request()

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\flask\app.py", line 1499, in dispatch_request

    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\dash_auth\basic_auth.py", line 33, in wrap

    response = f(*args, **kwargs)

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\dash\dash.py", line 1096, in dispatch

    response.set_data(func(*args, outputs_list=outputs_list))

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\dash\dash.py", line 1027, in add_context

    _validate.validate_multi_return(output_spec, output_value, callback_id)

    File "C:\Users\denis.akvic\AppData\Local\Programs\Python\Python39\Lib\site-packages\dash\_validate.py", line 136, in validate_multi_return

    raise exceptions.InvalidCallbackReturnValue(

    dash.exceptions.InvalidCallbackReturnValue: The callback ..pie_chart.figure...excel_data32.data.. is a multi-output.
    Expected the output type to be a list or tuple but got:
    Figure({
        'data': [], 'layout': {'template': '...'}
    }).

And this one also:

Traceback (most recent call last):
  File "C:\Users\denis.akvic\Desktop\BDE\flask\apps\app3.py", line 445, in create_pie_chart
    query_string = mssql_queries.build_db_query_string_defect_descriptions()
TypeError: build_db_query_string_defect_descriptions() missing 1 required positional argument: 'langauge'

HI @Traxdata,

Rather than pasting the entire code, it would be helpful to make a minimal example, including some sample data that reproduces the problem. To find out more information, please see this post: How to Get your Questions Answered on the Plotly Forum