SET UP Trying to use the QGIS tool "saveselectedfeatures" in a script I'm writing as follows: processing.runalg('qgis:saveselectedfeatures', Input, 'Output.shp') My "Input" layer definitely has features selected. *** QUESTION 1) How do I correctly fill in the parameters in my own script without the errors (described below) that I'm getting? Note: When I run the "saveselectedattributes" tool straight from the Toolbox (not in a self-authored script) it works! *** ERRORS 1) When run from the Console this line of code produces the following error in the "OGR" tab of the Log Messages window: Feature geometry not imported (OGR error: Pointer 'hTeom' is NULL in 'OGR_G_ImportFromWkb'. 2) When run from its own script from the Toolbox it gives a long Uncaught Error message in the Processing Tab of the Log Messages window, which at the end says this: AttributeError: VectorWriter instance has no attribute 'filename'| 'filename' ? The tool's own help tab asks for only 2 parameters and 'filename' isn't one of them. I assume this message is referring to "output_layer"? But I've tried other variations with that parameter such as taking away the shapefile extension and just putting 'Output', but still no luck. ********* CODE from PyQt4.QtCore import * from qgis.core import * from qgis.utils import iface import processing ##Input=vector ##Input_Field=field Input # Assign .CSV of streets assigned to employees, "FSS_Streets_Test_Sample", to variable 'vl' vl = QgsMapLayerRegistry.instance().mapLayersByName('FSS_Streets_Test_Sample')[0] # Set vl as the "Active layer" iface.setActiveLayer(vl) # Instantiate 'streets' list streets = [] # Get List of Unique streets from 'STRNAME' column in 'vl' for f in vl.getFeatures(): if f['STRNAME'] not in streets: streets.append(f['STRNAME']) # Instantiate list of streets assigned to "Joe Blow" joeblow = [] # fill that list with streets belonging to "Joe Blow" as indicated in 'vl' for f in vl.getFeatures(): if f['FSS'] == 'Joe Blow': joeblow.append(f['STRNAME']) #Count number of streets belonging to "Joe Blow" z = len(joeblow) # FINAL ITERATION LOOP: Iterate through streets belonging to "Joe Blow", each time selecting from the "Input" shapefile, all fields (civic addresses) where the "Input_Field" (STRNAME), equals ("0"), particular street(s) belonging to 'joeblow' (street(s) within the 'joeblow' list) for k in range(0,z): processing.runalg('qgis:selectbyattribute', Input, Input_Field, 0, joeblow[k]) processing.runalg('qgis:saveselectedfeatures', Input, 'Output') # End Script