<div dir="ltr">Hi Nyall:<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 10, 2018 at 2:20 AM, Nyall Dawson <span dir="ltr"><<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_4685129332240610144gmail-">On 10 April 2018 at 01:03, Stephen Bosch <<a href="mailto:posting@vodacomm.ca" target="_blank">posting@vodacomm.ca</a>> wrote:<br>
</span><span class="gmail-m_4685129332240610144gmail-"><br>
> I've tried calling the algorithm this way:<br>
><br>
>> file_grid_r = processing.run("grass7:<a href="http://v.to" target="_blank">v.to</a>.ra<wbr>st", {'INPUT': grid_v, 'type':<br>
>> 0, 'use': 1, 'GRASS_REGION_PARAMETER': extent}, feedback=None)<br>
><br>
<br>
</span>Looks correct<br>
<span class="gmail-m_4685129332240610144gmail-"><br>
> But it fails. On the console, I see<br>
><br>
>> sys:1: ResourceWarning: unclosed <socket.socket fd=3,<br>
>> family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0,<br>
>> laddr=('127.0.0.1', 41358), raddr=('127.0.0.1', 37307)><br>
<br>
</span>That can be ignored - it's unrelated.<br></blockquote><div><br></div><div>(Messages like this occur only when the process exits with a code other than 0.)<br><br></div><div>I should add that, without using the debugger, I wouldn't be able to see the error at all. Is that intended behaviour? Is there any way to turn it on? The absence of exceptions and tracebacks make things fail silently, which can have nasty consequences.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="gmail-m_4685129332240610144gmail-">><br>
> If I step through the code in PyCharm and trace the exception, I see an<br>
> AttributeError: 'NoneType' object has no attribute 'messageBar'.<br>
<br>
</span>Where is this thrown? I suspect the problem is because you're passing<br>
"feedback=None" and somewhere there's code which is expecting a valid<br>
feedback object. Can you let me know which line the exception is<br>
thrown on and I'll fix?<br></blockquote><div><br>It is thrown in line 42 of MessageBarProgress.py:<br>__init__ [MessageBarProgress.py:42]  id:94435226437000<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
In the meantime try passing a feedback object:<br>
<br>
   feedback = QgsProcessingFeedback()<br></blockquote><div><br></div><div>That seemed to correct the messageBar error, thanks.<br></div><div><br></div><div>After correcting the statement to the following:<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 = QgsRasterLayer()</span><br><span style="font-family:monospace,monospace">processing.run("grass7:v.to.rast", {'input': grid_v, 'type': 0, 'use': 1,</span><br><span style="font-family:monospace,monospace">                                    'GRASS_REGION_PARAMETER': extent,</span><br><span style="font-family:monospace,monospace">                                    'output': file_grid_r,</span><br><span style="font-family:monospace,monospace">                                    'GRASS_REGION_CELLSIZE_PARAMETER': 0.008333,</span><br><span style="font-family:monospace,monospace">                                    'GRASS_SNAP_TOLERANCE_PARAMETER': -1,</span><br><span style="font-family:monospace,monospace">                                    'GRASS_MIN_AREA_PARAMETER': 0.000100},</span><br><span style="font-family:monospace,monospace">                             feedback=QgsProcessingFeedback())</span><br></blockquote><br> I get the message<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">Unable to execute algorithm<br>Incorrect parameter value for output</span><span style="font-family:monospace,monospace"><span></span></span><br><span style="font-family:monospace,monospace"><span></span></span></blockquote><span style="font-family:monospace,monospace"><span><br></span></span></div><div><span style="font-family:arial,helvetica,sans-serif">I've tried a couple of variations (specifying 'output' as an index and assigning it to a variable while setting 'output': None in the dictionary, for example) and get the same error.<br></span></div><div><span style="font-family:arial,helvetica,sans-serif"></span><span style="font-family:monospace,monospace"><span><br></span></span></div><div><span style="font-family:arial,helvetica,sans-serif">In my 2.x code, I just used the index and assigned the return to a variable. The implementation of v.to.rast for QGIS 3 Processing seems to require a value for output, and simply putting an variable doesn't work either (it complains that the variable is undefined).<br><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">With a few more hints, I'm sure I'll get the hang of this ;-)<br></span><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">Thanks<br><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">Stephen</span><span style="font-family:monospace,monospace"><br></span></div></div></div></div>