I need to be able to select one feature/record at a time within a polygon shapefile, regardless of how many shapes it contains, using open source python libraries (e.g., OGR, pyshp, fiona). Then I want to use each feature/record in a different function that requires a shapefile format. Below is what I'm attempting with pyshp:
shp = shapefile.Reader(file) ## open and read the shapefile shp = shp.shapes() ## read the geometry information of each shape record shpInPoly =  ## empty array that will contain the features in the file for i in shp: shpInPoly.append(i)
Then I'd assume I could grab the first feature in the array of appended features like this:
currentPolygon = shpInPoly
And use the "currentPolygon" variable in my other function with the first record/feature in the original shapefile.
But it doesn't work. The error I get in my other function which requires shapefile inputs is "shapefile.ShapefileException: Shapefile Reader requires a shapefile or file-like object." The other alternative, per the question title (and what I'm thinking is likely best), would be to export that selected feature/record and all its content (geometry and fields) to a new shapefile, to achieve the same purpose of using that in another shapefile-requring function. The only posts I found that attempt something similar are Exporting Selected Feature to New Shapefile using ArcPy? and Splitting shapefile into many shapefiles with open source?, but I can't use ArcPy.