Hi,
so I am trying to use a virtual display to capture the screen and display the captured frames to the screen. For that I am using pyvirtualdisplay Python package which uses xvbf.
My code for that is:
from pyvirtualdisplay import Display

def execute(env_name, model_path, epochs, dump_path, include):
  with Display(visible=False) as disp:
    env, policy = setup(env_name, model_path, dump_path, include)
    with st.empty():
      for epoch in range(1, epochs+1):
        for img in rollout(env, policy):
          st.image(img, caption=f"Epoch {epoch}")

The rendering works as expected. But as soon as the virtual display is closed, I get the following error.

image1272×931 10.5 KB


I am guessing that closing the virtual display broke something in the streamlit.