I'm getting an error in Apache error_log with WSGI and PyQt4 :
: cannot connect to X server
My Python code looks like :
import PyQt4.qtgui as qtgui
__qt_app = qtgui.QApplication([])
I had a minimal CentOS installation and I had to install lightweight X server (group "X Window System" and some other rpms).
Previous code is working in a console after the X server installation (before was not).
Environment : CentOS 6.5, Apache 2.2.15, mod_wsgi 4.3.0.
Any clue about what could happening ?
I found a "solution", i re-installed minimal CentOS (i don't need X server) and i added the xorg-x11-server-Xvfb
package.
Start Xvfb on display 99 :
/usr/bin/Xvfb :99 -screen 0 640x480x24
Edit python code :
import os
import PyQt4.qtgui as qtgui
os.environ['DISPLAY'] = ':99'
__qt_app = qtgui.QApplication([])
And everything is working.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments