✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

Hi guys
I am getting the above error once I embedd Divs like

       ' html.Div([dcc.Dropdown(id='dropdown'),'
       '                dcc.Graph(id='graph'),'
       '              html.Div('
       '                           html.Div(id = ' my-pics'),'
       '                           html.Div(id='my-foot'),'
       '               ),'

    ])
    @app.callback(dash.dependencies.Output('my-foot', 'children'),
                  [dash.dependencies.Input('dropdown', 'value')])
    @app.callback(Output('graph', 'figure'), [Input('dropdown', 'value')])
    @app.callback(dash.dependencies.Output('my-pics', 'children'),
                  [dash.dependencies.Input('dropdown', 'value')])

the challenge is for id=‘my-foot’ am getting an error. ‘TypeError: init() takes from 1 to 2 positional arguments but 3 were given’ if its embedded into the Div, but outside it functions properly

1 Like

The first argument of the html.Div is the children property, this needs to be an array a list.

You have:

html.Div(html.Div(id='my-pics'), html.Div(id='my-foot'))

It needs to be
You have:

html.Div([html.Div(id='my-pics'), html.Div(id='my-foot')])
2 Likes

Thanks, ran in a flash.

1 Like