Bad message format - 'setIn' cannot be called on an ElementNode

Hello,

I am pretty new to Streamlit. Thank you for this wonderful app.

I am getting the following error while running my code.
Bad message format - ‘setIn’ cannot be called on an ElementNode

Below is my code

import streamlit as st

def keyboard():
    st.write(""" ## Keyboard""")
    kb_line1 = st.empty()
    q, w, e, r, t, y, u, i, o, p, dummy_0,  = kb_line1.beta_columns(11)
    user_input_dialog = st.empty()

    q_btn, w_btn, e_btn, r_btn, t_btn = q.button("Q"), w.button("W"), e.button("E"), r.button("R"), t.button("T")
    y_btn, u_btn, i_btn, o_btn, p_btn = y.button("Y"), u.button("U"), i.button("I"), o.button("O"), p.button("P")

    user_input=""

    if q_btn:
        user_input = "Q"
    if w_btn:
        user_input = "W"
    if e_btn:
        user_input = "E"
    if r_btn:
        user_input = "R"
    if t_btn:
        user_input = "T"
    if y_btn:
        user_input = "Y"
    if u_btn:
        user_input = "U"
    if i_btn:
        user_input = "I"
    if o_btn:
        user_input = "O"
    if p_btn:
        user_input = "P"

    if user_input != "" :
        user_input_dialog.write(""" ## You selected: """+user_input)
        kb_line1.empty()

if __name__ == "__main__" :
    keyboard()

Basically, I was trying to create the first row of a keyboard.
I want to erase the keyboard layout after user select an alphabet. That’s why I use the line “kb_line1.empty()”. I guess the error is associated with this line because commenting it executes the code well.

Could someone please explain me what the reason for this error is and if any solutions are available.
Any alternative proposal for my code is highly welcome.

Thanks
AJ

Hey @Akhil - welcome to Streamlit!

Yeah, this shouldn’t be happening - it’s a bug. I’m taking a look at it now. Thanks for the report!

Cheers, Tim

(ps: here’s a link to the GitHub issue in case you want to track it)

2 Likes

Thanks @tim for confirming the bug.
While looking at GitHub, I see that you fixed the issue.
Thanks