I try to run a simple code in pyqgis with no gui and I get a segmentation fault error by only invoking QGSApplication.
The code is the following one (under Ubuntu16.04 and with python 3.5)
from qgis.core import * # supply path to qgis install location QgsApplication.setPrefixPath(QgsApplication.prefixPath(), True) # create a reference to the QgsApplication, setting the # second argument to False disables the GUI qgs = QgsApplication(, False) # load providers qgs.initQgis() qgs.exitQgis()
In order to reproduce the error, I made a simple Github repository (https://github.com/mbrasebin/test_pyqgis_crash) with the code and a Travis configuration file (to set the environnement). The log error can be viewed on travis pages.
If you have an idea to correct the error (or at least to catch it) do not hesitate to answer and/or to fork the repository.
By launching the script with gdb, the error seems to be related to a QT class used through qgis. If you have an idea to avoid or catch this error ...
Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x00007fffeaf23261 in QSqlDatabase::close() () from /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5