PyQGIS – Processing.runalg() Throws ‘TypeError: Catching Classes That Do Not Inherit from BaseException Is Not Allowed’

pyqgisqgis-3qgis-processing

Hi everyone I'm in some way new with PyQGIS and I've been trying to run a script in QGIS 3.0 without success (it prefectly ran in 2.18) and always get the same error:

AttributeError: module 'processing' has no attribute 'runalg'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "", line 8, in
TypeError: catching classes that do not inherit from BaseException is not allowed

Does this has something to do with PYTHONPATH? I can't even see the list of algorithms when typing: processing.alglist()

Best Answer

In QGIS 3, use processing.run.

For instance:

QGIS 2.x processing.runalg('gdalogr:convertformat', ...

QGIS 3.0 processing.run('gdal:convertformat', ...

Related Question