AnsweredAssumed Answered

Intersect issue in an iterative python script tool

Question asked by npssde on Dec 6, 2012
Latest reply on Dec 10, 2012 by npssde

I have a script tool (10.0 SP5, Python 2.6) that intersects a fishnet polygon and a line feature class.  The script uses an iterative loop to process individual single-part area of interest (i.e. extent) polys, running the intersect operation for each area of interest.  The code works great if no iteration occurs, but blows up when iterating the second feature (the first runs correctly).  The intersect operation is the point of failure - no output features are produced for the second output.  However, the same code executes correctly as snippets when run from the Geoprocessing --> Python window using the same inputs as the script tool.  Also, the toolbox Intersect tool works correctly as well.  It's just the script tool version that blows up.  Here's the snippet: 

arcpy.CopyFeatures_management(AOA_Layer,"in_memory\\temp_aoa"); showGpMessage() rows = arcpy.SearchCursor("in_memory\\temp_aoa"); showGpMessage()  for row in rows:            ...# variable set-up, etc.            ...# where Input_Roads_Features and Fishnet_Output vars are set by single-part area of interest extent            ...# repair geometry is run on Input_Roads_Features and Fishnet_Output prior to intersect attempt             # Intersect             inFeatures = []             inFeatures.append(Input_Roads_Features)             inFeatures.append(Fishnet_Output)             arcpy.Intersect_analysis(inFeatures, Intersect_Fishnet, "ALL", "", "INPUT"); showGpMessage()

For the second iteration, Intersect_Fishnet is produced but does not contain features.

Since the Python window and Intersect toolbox versions do work, my suspicion was that the 'inFeatures' list variable wasn't getting cleared/re-populated, but I think that does happen correctly since I re-initialize the list. 

Any insight/tips on iterative processing appreciated!