I want to run standalone python script in Docker with QGIS and Ubuntu Xenial and there is problem with GUI.
When QgsApplication is qgs = QgsApplication([],True, None)
the error is cannot connect to x server
. If I set QgsApplication to False qgs = QgsApplication([],False, None)
,the error is QPixmap: Cannot create a QPixmap when no GUI is being used
.
This is my initialization of the script
#!/usr/bin/env python
#import libraries
import sys, os
import qgis
from qgis.core import *
from PyQt4.QtCore import QFileInfo
# supply path to qgis install location
QgsApplication.setPrefixPath("/usr", True)
# create a reference to the QgsApplication
qgs = QgsApplication([],True, None) #preco hadze False chybu, ked nechcem vyuzit GUI ?
#app.setPrefixPath("/usr", True)
# load providers
qgs.initQgis()
# import processing and set system path to processing
sys.path.append('/usr/share/qgis/python/plugins')
from processing.core.Processing import Processing
Processing.initialize()
from processing.tools import *
How to initialize script to get it running ? I do not need GUI.
QPixmap
error occurs?