I am trying to build a dashboard using Dash. I keep getting this error when I go to the default website http://127.0.0.1:8050/ and I get TypeError: cannot convert 'NoneType' object. Check the image for the error. My code does not have any mistakes and I was able to run it before and the dashboard would work perfectly. Can someone please help me? Here is the code:
import dash # (version 1.12.0) pip install dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import datetime
from datetime import date
app = dash.Dash(__name__)
# App layout
app.layout = html.Div([
html.H1("Snodas SWE/SD For January", style={'text-align': 'center'}),
dcc.DatePickerSingle(
id='my-date-picker-single',
min_date_allowed=date(2020, 1, 1),
max_date_allowed=date(2020, 12, 30),
initial_visible_month=date(2020, 1, 1),
date=date(2020, 1, 1)
),
html.Div(id='output-container-date-picker-single'),
dcc.Checklist(
options=[
{'label': 'SWE', 'value': 'SWE'},
{'label': 'SD', 'value': 'SD'}
],
labelStyle={'display': 'inline-block'}
),
html.Iframe(id='map', srcDoc=open('map1.html', 'r').read(), width='100%', height='1000')
])
@app.callback(
Output('map', 'srcDoc'),
Input('my-date-picker-single', 'date'))
def update_output(date):
return open('map_swe_sd_{}.html'.format(str(date)), 'r').read()
if __name__ == "__main__":
app.run_server(debug = True)
Error Message
question from:
https://stackoverflow.com/questions/66054086/python-dash-typeerror-cannot-convert-nonetype-object-to-bytes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…