I hate to bug you all with the same problem over and over again but I run into a new problem everytime I make a slight change to the code. All I did to the code below was to replace field names to match the original feature class. Now it doesn't work. It gave me
<type 'exceptions.RuntimeError'>: ERROR 999999: Error executing function.
Failed to execute (Script).
I tried adding Try/Except to the code which didn't give me any error messages but didn't give me any results either.
I'm not sure what's going on? Any help to figure this out will be very much appreciated.
import arcpy, os Try: roadpath = arcpy.GetParameterAsText(0) tablepath = arcpy.GetParameterAsText(1) datapath = os.path.split(tablepath) tablename = os.path.split(tablepath) rows = arcpy.SearchCursor(roadpath,"FROMLEFT <> 0 AND TOLEFT <> 0","","STREET_NAME_ID;FROMLEFT;TOLEFT","STREET_NAME_ID A;FROMLEFT A;TOLEFT A") arcpy.env.workspace = datapath if arcpy.Exists(tablename): arcpy.DeleteRows_management(tablename) else: arcpy.CreateTable_management(datapath,tablename,roadpath) arcpy.DeleteField_management(tablename,"SHAPE_Length") irows = arcpy.InsertCursor(tablename) first = True for row in rows: if first: first = False else: GISID = row.GIS_ID stid = row.STREET_NAME_ID fl = row.FROMLEFT tl = row.TOLEFT if stid == prev_stid and fl <= prev_tl: irow = irows.newRow() irow.GIS_ID = prev_GISID irow.STREET_NAME_ID = prev_stid irow.FROMLEFT = prev_fl irow.TOLEFT = prev_tl irows.insertRow(irow) del irow irow = irows.newRow() irow.GIS_ID = GISID irow.STREET_NAME_ID = stid irow.FROMLEFT = fl irow.TOLEFT = tl irows.insertRow(irow) del irow prev_GISID = row.GIS_ID prev_stid = row.STREET_NAME_ID prev_fl = row.FROMLEFT prev_tl = row.TOLEFT del rows, irows except: print arcpy.GetMessages()