Search code examples
pythonpidxvfbpyvirtualdisplay

How to get PID of process when using XVFB via Pyvirtualdisplay?


Trying to find the PID of a Display object when creating it using Pyvirtualdisplay. The display an Xvfb virtual framebuffer.

We have tried looking at the .pid property, but it is not present. Also, the .process property is non existant. Both raise an AttributeError error when accessed.

Thanks very much! Any help will be appreciated!


Solution

  • The answer to this situation is to actually use the .pid property on the display object, BUT, it is only present after the display has had the start method called on it. That means, if you need to get the PID for the process, the display has to be started first.