ponty / PyVirtualDisplay

Python wrapper for Xvfb, Xephyr and Xvnc
BSD 2-Clause "Simplified" License
714 stars 78 forks source link

Running the Script involving pyvirtualdisplay Twice crashes the Colab #64

Closed ghost closed 2 years ago

ghost commented 3 years ago

https://user-images.githubusercontent.com/59511669/107593275-c024f200-6bed-11eb-9da6-8c294cd3c731.mp4

Google Colab's Black Screenshot of Death: monitor-1

ponty commented 3 years ago

Please use text for reports: the program and the messages. I don't want to type in your program from the video.

Try first without mss. Is there any error then?

ghost commented 3 years ago

Please use text for reports: the program and the messages. I don't want to type in your program from the video.

Try first without mss. Is there any error then?

from pyvirtualdisplay import Display
try:  
  disp = Display().start()
except Exception as e:
  disp.stop()
  print(e)
else:
  disp.stop()
  print("Ok!")

Seems like that is mss issue then, also ImageGrab for Screenshot example listed on README.md doesn't work on Linux because it requires windows or mac to do so. (ImportError: ImageGrab is macOS and Windows only)

https://user-images.githubusercontent.com/59511669/108596497-33540400-7364-11eb-816b-bac0c7c1d31a.mp4

Log Error Captured By Google Colab: 482

ponty commented 3 years ago

Check https://github.com/ponty/pyscreenshot/issues/79

MSS was designed for X desktop and it reuses the display. It doesn't like if X is destroyed. For screenshot I recommend Pillow. My lib pyscreenshot can also be used.

If you get this error message on Linux then your Pillow version is old.

ImportError: ImageGrab is macOS and Windows only