Dash Scattermapbox Object Error

I’ve been getting mapbox to work great through Plotly, but can’t get it to work no matter what through plotly. Stripped the code to barebones, with a manually collected single data point, tried many different versions within a venv, etc. I am using a working mapbox key, and have verified other plots work just fine in Dash. Thanks in advance for any help!

When I try to run this code, I am getting the error:

“Invalid argument figure.data passed into Graph with ID “test”.
Expected an array.
Was supplied type object.”

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go

app = dash.Dash(__name__)

def scattermap():

    data = go.Scattermapbox(
        lat=['45.5017'],
        lon=['-73.5673'],
        mode='markers',
        marker=go.scattermapbox.Marker(
            size=14
        ),
        text=['Montreal'],
    )

    layout = go.Layout(
        hovermode='closest',
        mapbox=dict(
             accesstoken=MAPBOX_KEY,
            bearing=0,
            center=go.layout.mapbox.Center(
                lat=45,
                lon=-73
            ),
            pitch=0,
            zoom=5
        )
    )

    return dict(data=data, layout=layout)

app.layout = html.Div([

        dcc.Graph(id='test',
                  figure=scattermap()),

])


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

wrap go.Scattermapbox in square brackets so that it’s a list.

Any suggestions on how we could make this error message clearer?

Ahh, actually that error message makes sense and I feel foolish now. Thanks so much!