Bug report #21789

Can't define a RASTER_LAYER input parameter type when defining a new @decorator style processing algoritm

Added by enrico ferreguti 8 months ago. Updated 6 months ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:Processing/Core
Affected QGIS version:3.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29604

Description

as from https://github.com/qgis/QGIS-Documentation/blob/c1c228eb8a3ab4c5f72ef10f323070f64dd23056/source/docs/user_manual/processing/scripts.rst

Defining a raster input parameter:
@alg.input(type=alg.RASTER_LAYER, name='DTM_LAYER', label="Layer DTM")

and running the Algorithm I get the following exception:

Processing: Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis/./python\qgis\processing\algfactory.py", line 193, in _create_param make_func = input_type_mapping[type] KeyError: ('RASTER_LAYER',) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\script\ScriptEditorDialog.py", line 228, in runAlgorithm exec(self.editor.text(), _locals) File "", line 16, in File "C:/OSGEO4~1/apps/qgis/./python\qgis\processing\algfactory.py", line 456, in input self.current.add_input(type, *args, **kwargs) File "C:/OSGEO4~1/apps/qgis/./python\qgis\processing\algfactory.py", line 157, in add_input parm = self._create_param(type, **kwargs) File "C:/OSGEO4~1/apps/qgis/./python\qgis\processing\algfactory.py", line 195, in _create_param raise ProcessingAlgFactoryException("{} is a invalid input type".format(type)) qgis.processing.algfactory.ProcessingAlgFactoryException: ('RASTER_LAYER',) is a invalid input type

History

#1 Updated by Alexander Bruy 6 months ago

  • Status changed from Open to Feedback

Should be fixed in latest master, please test.

Also available in: Atom PDF