An exception has occurred, use %tb to see the full traceback

Dash is running on http://127.0.0.1:8050/

  • Serving Flask app “main” (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on
    An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

Getting above error when trying to run below code-

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd

external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]

app = dash.Dash(name, external_stylesheets=external_stylesheets)

colors = {
‘background’: ‘#111111’,
‘text’: ‘#7FDBFF
}

assume you have a “long-form” data frame

see Plotly Express Arguments | Python | Plotly for more options

df = pd.DataFrame({
“Fruit”: [“Apples”, “Oranges”, “Bananas”, “Apples”, “Oranges”, “Bananas”],
“Amount”: [4, 1, 2, 2, 4, 5],
“City”: [“SF”, “SF”, “SF”, “Montreal”, “Montreal”, “Montreal”]
})

fig = px.bar(df, x=“Fruit”, y=“Amount”, color=“City”, barmode=“group”)

fig.update_layout(
plot_bgcolor=colors[‘background’],
paper_bgcolor=colors[‘background’],
font_color=colors[‘text’]
)

app.layout = html.Div(style={‘backgroundColor’: colors[‘background’]}, children=[
html.H1(
children=‘Hello Dash’,
style={
‘textAlign’: ‘center’,
‘color’: colors[‘text’]
}
),

html.Div(children='Dash: A web application framework for Python.', style={
    'textAlign': 'center',
    'color': colors['text']
}),

dcc.Graph(
    id='example-graph-2',
    figure=fig
)

])
if name == ‘main’:
app.run_server(debug=True)

Please help