I have configured a QGIS project with option processing to skip invalid features.

enter image description here

When I run my script in python console in QGIS the code runs without problems even with invalid geometries.

When I run the standalone code with launch.bat there is an error. The error is the same that happened before I had manually set the options in the project. I conclude that the standalone code does not take into account the QGIS options.

In the code there is this part that in my opinion should integrate the options of the QGIS project.

project_path = os.getcwd() + '/change.qgz'
project_instance = QgsProject.instance()

I am sure that the project_path is ok, then it can only be that there is a lack of the part that allows to integrate the QGIS option in QGIS instance. I assume that is in the class QgsProject but I am not able to find. Does someone know how to solve this?

This seemed a solution: QGIS Python ignore invalid geometries

but it does not work.


1 Answer 1


Processing options shown in your screenshot are not stored in the project file but rather in the processing config settings.

You can add the following lines to your script (after import processing) to set the desired behavior for dealing with invalid feature geometries:

config = processing.ProcessingConfig
config.setSettingValue('FILTER_INVALID_GEOMETRIES', 1)

Once you access the ProcessingConfig object, you can print the list of options:

config = processing.ProcessingConfig

Should print:

['Do not filter (better performance)', 'Skip (ignore) features with invalid geometries', 'Stop algorithm execution when a geometry is invalid']

You can get the index of the option which is currently set like this (will print 0, 1 or 2):


Source code for ProcessingConfig:


See related question/answer here:

Pyqgis Qgis2 override Processing framework settings doesn't work

  • Now, it works. I assume that processing is the module of this link qgis.org/pyqgis/3.0/core/Processing/index.html. How can I find ProcessingConfig that I assume is function of the module processing? @Ben W
    – simone100
    Feb 3, 2023 at 14:29
  • @simone100, I have updated my answer with a bit more info.
    – Ben W
    Feb 5, 2023 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.