Select by attribute use cursor save off as feature class

Discussion created by digmapper on Feb 18, 2014
Latest reply on May 12, 2016 by digmapper
I feel this is a very basic problem but for the life of me I can't seem to figure out what is wrong, which is driving mad. I am assuming it is my logic. I have a feature class with hundreds of polygons. I figured I could make a layer file, use a search cursor to select each polygon and save each one off as it's own feature class. I seem to always get an error that the dataset xxxxx does not exist or is not supported when trying to do Copy Feature.  Here is what I have:

import sys, string, os, cx_Oracle, arcpy, datetime

arcpy.env.workspace = "c:\\work\\scripting\\test\\testdata.gdb"
rows = arcpy.SearchCursor("rsid_view","","","NUM; EXTENSION","NUM A")
row = rows.next()
while row:
    RSIDNum = str(row.getValue("NUM"))
    Ext = str(row.getValue("EXTENSION"))
    if Ext == "None":
        Ext = ""
    rsid = RSIDNum+Ext
    RSID = "RSID"+RSIDNum+Ext
    arcpy.CopyFeatures_management(RSID, "c:\\work\\scripting\\test\\testdata.gdb\\"+RSID)
    row - rows.next()
del row
del rows
if arcpy.Exists("rsid_view"):
   print "View deleted"

I have tried using Select by attribute first (before the search cursor) but that almost seems redundant, and I get the same problem anyway. Any help will be appreciated. Thanks in advance