Search code examples
pythonubuntupyvirtualdisplay

PyVirtualDisplay AttributeError: 'Display' object has no attribute 'old_display_var'


I get

AttributeError: 'Display' object has no attribute 'old_display_var' 

in PyVirtualDisplay when trying to stop display after tests execution:

in setUp method:

self.display = Display(visible=False, size=(1440, 900)) 
self.display.start()

then open browser and execute tests

and in tearDown method:

self.display.stop()

I want to stop display because of many opened Xvfb processes in ubuntu after several test execution


Solution

  • I got the same message yesterday. I forgot starting the display with self.display.start()

    Adding this to the file resolved the issue.