I'm just learning to write my own scripts in QGIS. For the first step of my script I want to use the QGIS geoalgorithm "Select by attribute", but am getting the error message "The following layers were not correctly generated: Output".
It goes on to say "You can check the log messages to find more information about the execution of the algorithm" but there is nothing extra written there.
Here's my script:
You can see that I've hardwired the operator as 1 (for '!=') and the selection value as "Sampson". When I run the script I fill in the GUI as follows:
I realize you can't see my input data layer, but let me assure you it is a standard shapefile. Not only that but I purposely chose the "does not equal" operator (1) so that it would be sure to select something.
The HELP tab of the "Select by attribute" tool offers...
"Console Usage: processing.runalg('qgis:selectbyattribute', input, field, operator, value, output)"
...but this explains nothing. Combined with the unhelpful "Log Message", I'm stuck.
Questions:
1) Can anyone solve this specific problem?
2) Does anyone else agree that learning QGIS scripting without helpful Log Messages or informative Tool Help explanations is very challenging?
Wouldn't a short example script be an incredibly powerful learning aid? Giving the user something as simple as my script (if it worked) would not only lay out the correct order of parameters, but it could also clarify how those parameters get set, which of those parameters require double or single quotations around them, and a host of other issues that a newbie like me should know about in order to write successful scripts.
Just my own 2 cents after scouring the internet for QGIS scripting resources similar to the excellent ArcGIS Help page.
Many thanks to those who reply!
أكثر...
It goes on to say "You can check the log messages to find more information about the execution of the algorithm" but there is nothing extra written there.
Here's my script:

You can see that I've hardwired the operator as 1 (for '!=') and the selection value as "Sampson". When I run the script I fill in the GUI as follows:

I realize you can't see my input data layer, but let me assure you it is a standard shapefile. Not only that but I purposely chose the "does not equal" operator (1) so that it would be sure to select something.
The HELP tab of the "Select by attribute" tool offers...
"Console Usage: processing.runalg('qgis:selectbyattribute', input, field, operator, value, output)"
...but this explains nothing. Combined with the unhelpful "Log Message", I'm stuck.
Questions:
1) Can anyone solve this specific problem?
2) Does anyone else agree that learning QGIS scripting without helpful Log Messages or informative Tool Help explanations is very challenging?
Wouldn't a short example script be an incredibly powerful learning aid? Giving the user something as simple as my script (if it worked) would not only lay out the correct order of parameters, but it could also clarify how those parameters get set, which of those parameters require double or single quotations around them, and a host of other issues that a newbie like me should know about in order to write successful scripts.
Just my own 2 cents after scouring the internet for QGIS scripting resources similar to the excellent ArcGIS Help page.
Many thanks to those who reply!
أكثر...