When running PyQGIS testing 2.99 the following coredumps:
from qgis.core import *
QgsApplication.setPrefixPath("/usr", False)
qgs = QgsApplication([], False)
qgs.initQgis()
How to start migrating PyQGIS scripts to the upcoming QGIS 3?
See http://doc.qt.io/qt-5/embedded-linux.html :
Since the Qt 5.0 release, Qt no longer contains its own window system (QWS) implementation.
One solution (apart from e.g. setting the DISPLAY environment variable to some X-over-ssh value) is:
export QT_QPA_PLATFORM=offscreen
The programmatical way in Python is:
import os
from qgis.core import *
os.environ["QT_QPA_PLATFORM"] = "offscreen"
QgsApplication.setPrefixPath("/usr", False)
qgs = QgsApplication([], False)
qgs.initQgis()
QgsApplication.setPrefixPath
line. Strangely, it runs no problem in the QGIS python console. I've setup all of the necessary environment variables on my Windows 7.
Commented
Jun 7, 2018 at 16:26