title: Running Xvfb from Python
body: <p>I am working on a server with no X servers and trying to run a script that uses spynner module, which requires an X server. For this purpose, I want to run Xvfb. </p>
  
  <p>I can run the script by calling it via <code>xvfb-run</code>, i.e.:</p>
  
  <pre><code>xvfb-run python2.6 try.py.
  </code></pre>
  
  <p>This works with no problem. However, I need to invoke Xvfb from within the script. For this purpose, I tried using subprocess as follows:</p>
  
  <pre><code>xvfb = subprocess.Popen(['Xvfb', ':99'])
  </code></pre>
  
  <p>After adding this piece of code to the beginning of the script, and trying to run the script as</p>
  
  <pre><code>python2.6 try.py
  </code></pre>
  
  <p>I get the message: </p>
  
  <pre><code>: cannot connect to X server 
  </code></pre>
  
  <p>Is there something else I need to do? Thanks in advance.</p>