Problem closing virtual display

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.

image

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

1 Like

Hi @RajK853

May I check that it is working in your local environment?

Thanks,
Charly

Hi @Charly_Wargnier,

I have the same issue also in my local environment.

Best regards,
Raj Kumar Rana

What’s your operating system?

I am using Ubuntu 20.04 LTS