Hi,
I am using the st.empty() to reserve some space where to print elements after. I am getting an error message everytime I use the app because of this:
This is my code:
import streamlit as st
from ast import literal_eval
import plotly.express as px
box1 = st.empty()
box2 = st.empty()
box3 = st.empty()
box4 = st.empty()
box5 = st.empty()
box6 = st.empty()
def charge_dict(name):
try:
f = open(name, "r")
input = f.read()
# If file does not exist, create a new one with the blank values array, close it and read the content again
except FileNotFoundError:
st.write("Error: no file found")
# Once the content is saved in input string, close the file
finally:
f.close()
# Read the input string and generate a dictionary out of it
results = literal_eval(input)
return results
def results_menu():
results = charge_dict("results.txt")
information = charge_dict("output.txt")
questions = []
for i in range(0, information["Number of questions"]):
questions.append(information["Questions"][i])
box1.selectbox(label="Select a question to see the results", options=questions, index=0)