[Qgis-developer] Error : cannot connect to X server on Ubuntu

devquestions2 at gmail.com devquestions2 at gmail.com
Wed Dec 10 11:50:23 PST 2014


Yeah, I am trying to use headless application. I was able to overcome the
earlier error, but now i am stuck with a new error message.

"QPixmap: Cannot create a QPixmap when no GUI is being used"
"QPixmap: Cannot create a QPixmap when no GUI is being used"
"QPixmap: Cannot create a QPixmap when no GUI is being used"

Now I am creating QApplication by passing flase for ui mode.
>>app = QgsApplication([], False)

Here is the revised code.

I thought someone should figured this out before.  It is so painful to use
qgis in headless mode !!


import os
import sys

qgisprefix = '/usr'
#qgisprefix='/usr/share/qgis/resources'

# configure paths for QGIS
sys.path.insert(0, qgisprefix+'/share/qgis/python')
sys.path.insert(1, qgisprefix+'/share/qgis/python/plugins')

# disable QGIS debug messages
#os.environ['QGIS_DEBUG'] = '-1'
os.environ['DISPLAY']=""
# import QGIS modules
from qgis.core import *

#from qgis.gui import *

# configure QGIS paths
QgsApplication.setPrefixPath(qgisprefix, False)

# initalise QGIS
QgsApplication.initQgis()

app = QgsApplication([], False)

import processing



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Error-cannot-connect-to-X-server-on-Ubuntu-tp5177029p5177312.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list