zatch3301/covid-live-update

Error when COIVD 19 data for a country does not exist.

Closed this issue · 2 comments

Simple exception handling might do the trick.

IndexError: list index out of range
Traceback:

File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/ScriptRunner.py", line 319, in _run_script
    exec(code, module.__dict__)
File "/app/app.py", line 77, in <module>
    st.write("""# Total """+graph_type+""" cases in """+country1+""" are: """+str(r.json()[-1].get("Cases")))

it's from the REST API data, the data is not is available for many countries.

I can take this. Looking at the code, it looks like it's a simple check.