Error "Cannot connect to X server" with Python program webkit2png
<p>When I use webkit2png on my SSH-server, I get the error: "Cannot connect to X server:0.0"
Webkit2png is a package that makes a PNG screenshots of htmlpages.
On my computer it worked perfectly, but on the SSH server not; it doens't create an PNG-image.</p>

<p>It only works when I do this command: </p>

<pre><code>xvfb-run -a -s "-screen 0 640x480x16" python webkit2pngProgram.py
</code></pre>

<p>But that's an Unix command, and not Python code.</p>

<p>The webkit2pngProgram code:</p>

<pre><code>from webkit2png import WebkitRenderer, init_qtgui
from PyQt4.QtCore import QTimer

def renderer_func():
   renderer = WebkitRenderer()
   renderer.width = 550
   renderer.height = 500   
   renderer.timeout = 10
   renderer.wait = 1
   renderer.format = "png"
   renderer.grabWholeWindow = False
   y = Program()
   outfile = open("/image.png", "w")

   renderer.render_to_file("/test.html", file=outfile)
   outfile.close()

def start():
   app = init_qtgui()   ###### =&gt; STUCKS HERE
   QTimer.singleShot(0, renderer_func)
   app.exec_()

if __name__ == "__main__":
    start()
</code></pre>

<p>Thanks for your help!</p>
