I am new to QGIS Python scripting. I want to select some features from an input layer and save them to a memory layer for further processing. Here is my code:
##Sampled_trees=vector
##Input_field= field Sampled_trees
from qgis.core import *
from PyQt4.QtCore import *
inputTrees= processing.getObject(Sampled_trees)
inputField = inputTrees.fieldNameIndex(Input_field)
tempLayer = QgsVectorLayer("Point", "temporary_points", "memory")
processing.runalg("qgis:selectbyattribute", inputTrees, inputField,0,1,inputTrees)
processing.runalg('qgis:saveselectedfeatures', inputTrees, tempLayer)
When the last line is executed, I get the error:
TypeError: 'QgsVectorLayer' object has no attribute 'getitem'
How can I fix this issue?