I’m working on deploying something and it’s been going fine, but then I started getting all these weird syntax errors. Two examples:
A)
This code works totally fine and displays the chart:
ward_housing_cost = alt.Chart(df_ward).mark_bar().encode(
alt.X('Ward:N', axis=alt.Axis(format='d')),
alt.Y('avg_housing_cost_ward:Q', title = 'rating of housing cost',
scale=alt.Scale(domain=(0, 5))
).properties(title = 'Rating of housing cost by ward')
st.altair_chart(ward_housing_cost)
…but this one gets the syntax error:
ward_streets_sidewalks = alt.Chart(df_ward).mark_bar().encode(
alt.X('Ward:N'),
alt.Y('avg_streets_sidewalks_ward:Q', title = 'rating of maintenance of
streets/sidewalks')
).properties(title = 'Rating of maintenance of streets/sidewalks by ward')
st.altair_chart(ward_streets_sidewalks)
here is what the error looks like:
File "/app/shs2021/streamlit_app.py", line 90
ward_streets_sidewalks = alt.Chart(df_ward).mark_bar().encode(
^
SyntaxError: invalid syntax
I have tried everything I can think of including rewriting the thing from scratch, renaming the chart, etc.
B) So then I took out all the ward charts to work on another part and the whole sidebar, which hadn’t touched, broke. Now I’m getting a brand-new syntax error on this, which - again - I have not touched:
navigation = st.sidebar.radio("Explore the data by:", ('Introduction', 'Overall trends', 'Age', 'Gender', 'Income', 'Race', 'Ward'))
this is what the error looks like:
File "/app/shs2021/streamlit_app.py", line 96
navigation = st.sidebar.radio("Explore the data by:", ('Introduction', 'Overall trends', 'Age', 'Gender', 'Income', 'Race', 'Ward'))
^
SyntaxError: invalid syntax
What is happening??