I am trying to run the default script that PyQGIS Cookbook provides along with adding few lines to read my project. It tries to read the read project but at the end gives a Segmentation Fault. How can I fix this?
import sys sys.path.append('/Applications/QGIS3.app/Contents/Resources/python') from qgis.core import * # supply path to qgis install location QgsApplication.setPrefixPath("/Applications/QGIS3.app/Contents/MacOS", True) # create a reference to the QgsApplication, setting the # second argument to False disables the GUI qgs = QgsApplication(, False) # load providers qgs.initQgis() project = QgsProject.instance() project.read('polygondata.qgs') print(project.fileName()) print(project.mapLayers()) # Write your code here to load some layers, use processing # algorithms, etc. # When your script is complete, call exitQgis() to remove the # provider and layer registries from memory qgs.exitQgis()