<div dir="ltr">Hi everyone,<br><div><br>I am trying to grasp how parameters are to be passed to Processing algorithms.<br><br>Thanks to Håvard Tveite's advice, I've understood that it is now done with a Python dictionary.<br><br>I'm trying to use the grass7 algorithm v.to.rast. Processing.algorithmHelp (thanks for the tip, Håvard) gives the following output:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace,monospace">----------------<br>Input parameters<br>----------------<br><br>input:  <QgsProcessingParameterVectorLayer><br>    Input vector layer<br><br>type:  <QgsProcessingParameterEnum><br>    Input feature type<br>        0 - point<br>        1 - line<br>        2 - boundary<br>        3 - area<br><br>where:  <QgsProcessingParameterString><br>    WHERE conditions of SQL statement without 'where' keyword<br><br>use:  <QgsProcessingParameterEnum><br>    Source of raster values<br>        0 - attr<br>        1 - cat<br>        2 - va<br>        3 - z<br>        4 - dir<br><br>attribute_column:  <QgsProcessingParameterField><br>    Name of column for 'attr' parameter (data type must be numeric)<br><br>rgb_column:  <QgsProcessingParameterField><br>    Name of color definition column (with RRR:GGG:BBB entries)<br><br>label_column:  <QgsProcessingParameterField><br>    Name of column used as raster category labels<br><br>value:  <QgsProcessingParameterNumber><br>    Raster value (for use=val)<br><br>memory:  <QgsProcessingParameterNumber><br>    Maximum memory to be used (in MB)<br><br>output:  <QgsProcessingParameterRasterDestination><br>    Rasterized<br><br>GRASS_REGION_PARAMETER:  <QgsProcessingParameterExtent><br>    GRASS GIS 7 region extent<br><br>GRASS_REGION_CELLSIZE_PARAMETER:  <QgsProcessingParameterNumber><br>    GRASS GIS 7 region cellsize (leave 0 for default)<br><br>GRASS_RASTER_FORMAT_OPT:  <QgsProcessingParameterString><br>    Output Rasters format options (createopt)<br><br>GRASS_RASTER_FORMAT_META:  <QgsProcessingParameterString><br>    Output Rasters format metadata options (metaopt)<br><br>GRASS_SNAP_TOLERANCE_PARAMETER:  <QgsProcessingParameterNumber><br>    v.in.ogr snap tolerance (-1 = no snap)<br><br>GRASS_MIN_AREA_PARAMETER:  <QgsProcessingParameterNumber><br>    v.in.ogr min area<br><br>----------------<br>Outputs<br>----------------<br><br>output:  <QgsProcessingOutputRasterLayer><br>    Rasterized</span><br></blockquote><div><br>The input types are described with terms like "<QgsProcessingParameterVectorLayer>"; what does this mean exactly? Do I need to pass class instances? In the previous (2.x) iteration of my code, I had statements like<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace,monospace">file_grid_r = processing.run("grass7:v.to.rast.value", grid_v, 0, 1,<br>     extent, 0.008333, -1, 0.000100, None)['output']</span><br></blockquote><br>where 'grid_v' is a QgsVectorLayer object and 'extent' is a string that looks like this:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace,monospace">'33.91415594546105,41.91384412832699,30.679722671256611,35.467319665842772'</span><br></blockquote><br>I've tried calling the algorithm this way:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace,monospace">file_grid_r = processing.run("grass7:v.to.rast", {'INPUT': grid_v, 'type': 0, 'use': 1, 'GRASS_REGION_PARAMETER': extent}, feedback=None)</span><br></blockquote><br>But it fails. On the console, I see<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:monospace,monospace">sys:1: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 41358), raddr=('127.0.0.1', 37307)><br><br>Process finished with exit code 1</span><br></blockquote><br>If I step through the code in PyCharm and trace the exception, I see an <span style="font-family:monospace,monospace">AttributeError: 'NoneType' object has no attribute 'messageBar'.</span><br><br>I'm not sure if this is a bug in QGIS or whether there is something wrong with my parameters.<br><br></div><div>Do you have any suggestions or ideas?<br><br></div><div>Thanks<br><br></div><div>Stephen<br></div><div><br><br></div></div></div>