I’m new to Plotly and am trying to use Dash. I found some sample code in an online tutorial and have tried to run it in a Google Colab notebook, but I get an error from the last two lines of the following code (problematic lines are bolded):
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children=‘Hello Dash’),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if name == ‘main’:
app.run_server(debug=True)
When I searched stack overflow to troubleshoot the error (“UnsupportedOperation: not writable”), I found a solution from another user on GitHub, and it was described as:
You need to edit the echo function definition at …/site-packages/click/utils.py the default value for the file parameter must be sys.stdout instead of None.
Do the same for the secho function definition at …/site-packages/click/termui.py
Unfortunately, there was no sample code given for how to make the edits indicated to echo and secho, and this is unfamiliar to me.
If you have any other suggestions for how to get Dash to run in a Google Colab notebook, I would love to hear them!