I have a Dash app where two functions have callbacks that take input from a dropdown box and generate a bar graph from a DataFrame via Cufflinks.
These charts both work, but they’ll occasionally produce an error all relating to auth.get_config_file()
.
I’m using
import cufflinks as cf
from plotly.offline import iplot
in my layout I have:
html.Div(
[dcc.Graph(id='my-graph1')],
style={'width': '49%', 'display': 'inline-block'}
),
html.Div(
[dcc.Graph(id='my-graph2')],
style={'width': '49%', 'display': 'inline-block'}
),
and then for both of these, I have functions that resemble:
@app.callback(
Output('my-graph1', 'figure'),
[Input('intermediate-value', 'children')]
)
def my_graph1(jsonified_team_data):
team = pd.read_json(jsonified_team_data, orient='split')
figure = team.iplot(
kind='bar',
barmode='stack',
asFigure=True
)
return figure
When switching between inputs from a dropdown, or sometimes when the page initially loads, I’ll encounter KeyErrors relating to:
config_colorscale=auth.get_config_file()['colorscale']
or dimensions=auth.get_config_file()['dimensions']
or theme = auth.get_config_file()['theme']
, but when I select the same input from the dropdown (and sometimes it takes a few times), the charts appear as expected.
Any idea what’s going on? I suspect it’s both functions using get_config_file()
at the same time? Any idea how to avoid this?