AnsweredAssumed Answered

Still not running Please help!

Question asked by armein01 on Oct 17, 2013
Latest reply on Oct 18, 2013 by armein01
#Set environment and declare varibles # arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:/CustomTools/DeerSurveyRoutes/rtsScratch.gdb"  coPath = "C:/CustomTools/DeerSurveyRoutes/RtsAnlysVectors.gdb/County" rasPath = "C:/CustomTools/DeerSurveyRoutes/RtsAnlysRasters.gdb/WVUReclass" opnFrstdRas = arcpy.Raster("C:/CustomTools/DeerSurveyRoutes/RtsAnlysRasters.gdb/WVUReclass") rasCellSz = (opnFrstdRas.meanCellHeight + opnFrstdRas.meanCellWidth) / 2 rtsPath = "C:/CustomTools/DeerSurveyRoutes/RtsAnlysVectors.gdb/SmplRts2012Edited4CountyAnalysis" #Tabulate Forested/Open for county # arcpy.CheckOutExtension("Spatial") arcpy.env.snapRaster = rasPath znFld = "CoZoneName" clsFld = "Value" outTble = "CoTbleOpenFrst"  arcpy.sa.TabulateArea(coPath,znFld,opnFrstdRas,clsFld,outTble,rasCellSz)  #Create Cursor to iterate through rts and dictionary to hold county forested/open value # updtCur = arcpy.UpdateCursor(rtsPath) row = updtCur.next()  coOFDict = dict([((r.COZONENAME, f.name),r.getValue(f.name)) for f in arcpy.ListFields(outTble) for r in arcpy.SearchCursor(outTble)])  #Loop to find buffer distance of each route that will contain the same forested percent as the county  return BuffDist # for row in updtCur:     buffDist = 402   #This will be meters as all my inputs are projected to UTM     frstPrcnt = 0     frstd = coOFDict[(row.getValue(znFld),'VALUE_2')]     opn = coOFDict[(row.getValue(znFld),'VALUE_1')]     nHbt = coOFDict[(row.getValue(znFld),'VALUE_0')]     lpChkVal = frstd / (frstd + opn + nHbt)     minLpChkVal = lpChkVal - (lpChkVal * .05)     maxLpChkVal = lpChkVal + (lpChkVal * .05)     newBuffVal = buffDist     x = 0      while frstPrcnt < minLpChkVal or frstPrcnt > maxLpChkVal:         thisFID = row.getValue('RouteID')         arcpy.MakeFeatureLayer_management(rtsPath, "selectedLine", ("RouteID" = thisFID)         arcpy.Buffer_analysis("selectedLine","lineBuffer",buffDist,"FULL","FLAT","ALL","RouteID")         arcpy.sa.TabulateArea("lineBuffer","RouteID",rasPath,clsFld,"BufferOFTble",rasCellSz)          rtOFDict = dict([((rRt.ROUTEID, fRt.name),rRt.getValue(fRt.name)) for fRt in arcpy.ListFields("BufferOFTble") for rRt in arcpy.SearchCursor("BufferOFTable")])          rtFrstd = rtOFDict[(row.getValue('RouteID'),'VALUE_2')]         rtOpn = rtOFDict[(row.getValue('RouteID'),'VALUE_1')]         rtNHbt = rtOFDict[(row.getValue('RouteID'),'VALUE_0')]         frstPrcnt = rtFrstd / (rtFrstd + rtOpn + rtNHbt)         newBuffVal = buffDist         x += 1         buffDist = buffDist + (x * 5 * rasCellSz)     row.setValue('BuffDist',newBuffVal)     updtCur.updateRow(row) del row, updtCur, f, r, fRt, rRt 

I am getting this error.  Processing seems to be stopping at the Buffer.  selectedLine is created with no data.
Error message:
untime error <class 'arcgisscripting.ExecuteError'>: ERROR 999999: Error executing function. An expected Field was not found or could not be retrieved properly. An expected Field was not found or could not be retrieved properly. [SmplRts2012Edited4CountyAnalysis] An expected Field was not found or could not be retrieved properly. An expected Field was not found or could not be retrieved properly. [SmplRts2012Edited4CountyAnalysis] An expected Field was not found or could not be retrieved properly. An expected Field was not found or could not be retrieved properly. [SmplRts2012Edited4CountyAnalysis] Failed to execute (Buffer).
>>>
I have also moved the following code out of the while and into the for with the same results.
  thisFID = row.getValue('RouteID')  arcpy.MakeFeatureLayer_management(rtsPath, "selectedLine", ("RouteID" = thisFID)

and changed the syntax of the where clause multiple times
'"RouteID" = thisFID'
"[RouteID] = thisFID"
I am working in ArcINFO 10.0 with file geodatabase in the python window.
Frustrated!
Alicia

Outcomes