You can comment every occurence of _LOGGER in browser_websocket_handler as a workaround. More specifically commenting this line lets you see “Hello world”
_LOGGER.debug("Received the following back message:\n%s", msg)
It seems it’s not safe to call _LOGGER inside the on_message callback. It also seems to be the case if you replace _LOGGER.debug("Received the following back message:\n%s", msg) with print(msg). The issue seems likely to be due to either trying to read msg or doing I/O inside on_message.
EDIT: It’s not due to I/O alone, reading the msg variable causes a crash, but otherwise it seems to be fine:
#_LOGGER.debug("Received the following back message:\n%s", msg)
_LOGGER.debug("Received the following back message:\n")
print("Hello")
EDIT (Reproduction):
Trying to trigger a string representation __repr__ of BackMsg causes a crash. Here’s a reproduction:
from streamlit.proto.BackMsg_pb2 import BackMsg
print("Start")
BackMsg().__repr__() # Crashes
print("End")
However, commenting the first print still works:
from streamlit.proto.BackMsg_pb2 import BackMsg
#print("Start")
test = BackMsg().__repr__() #Does not crash
print("Test: ", test, "end") #Test: end
Also happens with ButtonGroupProto used by st.feedback:
from streamlit.proto.ButtonGroup_pb2 import ButtonGroup as ButtonGroupProto
print("Start")
test = ButtonGroupProto().__repr__() # Crashes
print("Test: ", test, "end")