2

I have a php script that runs many python scripts. The python scripts utilize a headless firefox browser using pyvirtualdisplay and xvfb. My issue is that each python script opens a new Xvfb process on my linux server. Thus I get multiple processes stacking up and eventual run out of /tmp/ space.
My issue is similar to this one:
Xvfb multiple displays for parallel processing?
I would like to have one Xvfb server process open at all times and have all the python scripts utilize it.
Here is the python code I am using:
#set pyvirtual display
display = Display(visible=0, size=(800, 600))
display.start()

Community
  • 1
  • 1
Cosco Tech
  • 565
  • 1
  • 4
  • 22
  • I have resolved the issue by adding this line in my python code: `os.environ['DISPLAY'] = ':1'` and removing the lines listed above. – Cosco Tech Jul 14 '13 at 01:30
  • I also added this line `import os` something about posting a question on here helps me get to an answer myself!! – Cosco Tech Jul 14 '13 at 01:37
  • @GarrettCosco: It's called [Rubber duck debugging](http://en.wikipedia.org/wiki/Rubber_duck_debugging), aka [Asking the Bear](http://mail.scipy.org/pipermail/scipy-user/2010-August/026357.html) :) – unutbu Jul 14 '13 at 01:43
  • @GarettCosco you should write and accept your own answer as an actual answer instead of a comment. I know it might seem dumb but it would be helpful for people in the future. – Jordan Jul 14 '13 at 04:50

1 Answers1

1

I have resolved this issue by removing these lines from my python code:
#set pyvirtual display
display = Display(visible=0, size=(800, 600))
display.start()

and adding the following lines:
import os
os.environ['DISPLAY'] = ':1'

This way the python script uses the already open Xvfb process setup on display 1 instead of starting a new Xvfb server process.

Cosco Tech
  • 565
  • 1
  • 4
  • 22