I have difficulties with the processing package. I try to run a simple QGIS dissolve in pyQGIS 3. When I run the line :

from qgis.core import QgsVectorLayer

import processing
from processing.core.Processing import Processing

layer = QgsVectorLayer(layerPath, 'layer 1', 'ogr')

parameters = {'INPUT': layer,
              'OUTPUT': 'memory:'}
dissolved = processing.run('gdal:dissolve', parameters)

In QGIS Python Console, it works fine but when I try it in my script, it sends me the error message in the title. I run my scripts with a batch that imports all necessary libraries.

The full message is following :

File "C:\Program Files\QGIS 3.2\apps\qgis\python\plugins\processing\tools\general.py", line 96, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "C:\Program Files\QGIS 3.2\apps\qgis\python\plugins\processing\core\Processing.py", line 125, in runAlgorithm
    raise QgsProcessingException(msg)
_core.QgsProcessingException: Error: Algorithm gdal:dissolve not found

Maybe try 'qgis:dissolve' instead of 'gdal:dissolve.

Or check that Processing Toolbox / Settings / Providers / GDAL is activated?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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