title: sh.py not executing xvfb-run
body: <p>I'm trying to execute <code>xvfb-run</code> via py.sh but I'm getting <code>sh.ErrorReturnCode_1</code> and no resulting pdf being created.</p>
  
  <p>I created a small html file:</p>
  
  <pre><code>$ echo '&lt;h1&gt;Hello, World.&lt;/h1&gt;' &gt; test.html
  </code></pre>
  
  <p>And I then ran <code>xvfb_run</code> via sh.py in Python:</p>
  
  <pre><code>$ python
  Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
  [GCC 4.7.2] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; from sh import xvfb_run
  &gt;&gt;&gt; xvfb_run('--server-num=1 --server-args="-screen 0, 1024x768x24" '
  ...     '/usr/bin/wkhtmltopdf --ignore-load-errors', 'test.html', 'test.pdf')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 2, in &lt;module&gt;
    File "/home/mark/.virtualenvs/reports/local/lib/python2.7/site-packages/sh.py", line 726, in __call__
      return RunningCommand(cmd, call_args, stdin, stdout, stderr)
    File "/home/mark/.virtualenvs/reports/local/lib/python2.7/site-packages/sh.py", line 291, in __init__
      self.wait()
    File "/home/mark/.virtualenvs/reports/local/lib/python2.7/site-packages/sh.py", line 295, in wait
      self._handle_exit_code(self.process.wait())
    File "/home/mark/.virtualenvs/reports/local/lib/python2.7/site-packages/sh.py", line 309, in _handle_exit_code
      self.process.stderr
  sh.ErrorReturnCode_1: 
  
    RAN: '/usr/bin/xvfb-run --server-num=1 --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf --ignore-load-errors test.html test.pdf'
  
    STDOUT:
  
  
    STDERR:
  </code></pre>
  
  <p>I then check back in the shell to see if anything has been created and nothing has:</p>
  
  <pre><code>$ ls -l
  total 4
  -rw-rw-r-- 1 mark mark 23 May 22 07:54 test.html
  </code></pre>
  
  <p>So I then copy out the <code>xvfb-run</code> command from above and it works fine:</p>
  
  <pre><code>$ /usr/bin/xvfb-run --server-num=1 --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf --ignore-load-errors test.html test.pdf
  Loading page (1/2)
  Printing pages (2/2)                                               
  Done                                                           
  </code></pre>
  
  <p>And there is the PDF file I was trying to create:</p>
  
  <pre><code>$ ls -l
  total 12
  -rw-rw-r-- 1 mark mark   23 May 22 07:54 test.html
  -rw-rw-r-- 1 mark mark 7091 May 22 07:55 test.pdf
  </code></pre>
  
  <p>I then tried with the <code>call</code> method from the standard library:</p>
  
  <pre><code>&gt;&gt;&gt; from subprocess import call
  &gt;&gt;&gt; call(['/usr/bin/xvfb-run', '--server-num=1', '--server-args="-screen 0, 1024x768x24"', '/usr/bin/wkhtmltopdf', '--ignore-load-errors', 'test.html', 'test.pdf'])
  xvfb-run: error: Xvfb failed to start
  1
  </code></pre>
  
  <p>I then thought that the <code>DISPLAY</code> environment var isn't set but I'm not having any joy with that either:</p>
  
  <pre><code>&gt;&gt;&gt; import os
  &gt;&gt;&gt; os.environ["DISPLAY"]=":99"
  &gt;&gt;&gt; call(['/usr/bin/xvfb-run', '--server-num=1', '--server-args="-screen 0, 1024x768x24"', '/usr/bin/wkhtmltopdf', '--ignore-load-errors', 'test.html', 'test.pdf'])
  xvfb-run: error: Xvfb failed to start
  1
  
  &gt;&gt;&gt; call(['/usr/bin/wkhtmltopdf', '--ignore-load-errors', 'test.html', 'test.pdf'])
  wkhtmltopdf: cannot connect to X server :99
  1
  
  &gt;&gt;&gt; os.environ["DISPLAY"]=":1"
  &gt;&gt;&gt; call(['/usr/bin/wkhtmltopdf', '--ignore-load-errors', 'test.html', 'test.pdf'])
  wkhtmltopdf: cannot connect to X server :1
  </code></pre>
  
  <p>Any idea why py.sh and <code>call</code> couldn't run that command? Is there something I'm missing here?</p>