I am trying to write a code that will iterate through a table, and export each row in the table as a separate PDF. The first time through the loop works. The second time around it gives me the following error message: Runtime error Traceback (most recent call last): File "<string>", line 21, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\analysis.py", line 98, in Select raise e ExecuteError: ERROR 000732: Input Features: Dataset Congressional_District_7 does not exist or is not supportedI am using ArcGIS desktop 10.1This is the python code, I have also attached a copy:import arcpy from arcpy import analysis, env, management workspace = arcpy.env.workspace = "Y:/Office2/WDIA Mapping/April/Scratch.gdb" #fill in the path for the workspace env.overwriteOutput = True mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] distRows = arcpy.SearchCursor('us_house') #sets the search cursor. This may be the problem? #Try an update cursor to resolve looping problem? for row in distRows: distName = row.getValue("NAMELSAD") df.extent = row.SHAPE.extent df.scale = df.scale * 1.07 unique_name = arcpy.CreateUniqueName(distName) whereClause = "NAMELSAD <> '%s'" % distName #this results in the shadow selected_dist = analysis.Select(distName, unique_name, whereClause) #shadow applied to layer layerList = arcpy.mapping.ListLayers(mxd, "", df) #apply the symbology to the currentShadow layer arcpy.ApplySymbologyFromLayer_management (layerList[0], 'usHouseDist_05_shadow') title = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "*")[0] title.text = "trial run" #this is where we need to format the title so it can be dymanyic arcpy.mapping.ExportToPDF(mxd, "Y:/Office2/WDIA Mapping/April/firstTrial/district_'%s'" % distName) #remember to fix this line arcpy.mapping.RemoveLayer(df, layerList[0]) del distName, unique_name distRows.next() #arcpy.RefreshActiveView()