AnsweredAssumed Answered

I think my str object is screwing up Arcpy's ability to process feature classes?

Question asked by rgthurau on Oct 19, 2012
Latest reply on Oct 19, 2012 by Wayne_Whitley
Hi,
I am looping through multiple tiles named through a list of numbers. I call the tile feature classes by using the string object from the list. It looks like things work great (print shows my feature class), but I'm getting the same error with each tool:

Error:
Traceback (most recent call last):
  File "X:\01_Python\LandCover\FreshModels\TV_lc2.5_CombineAllLC_byTile_101912.py", line 47, in <module>
    arcpy.CalculateField_management(Trees, "grid_code", 100)
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 2727, in CalculateField
    raise e
RuntimeError: Object: Error in executing tool

Code: Gridnums = ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"] #range(1,18)  for i in Gridnums:     # Work Trees     grid = os.path.join(DirGrid, "ProcGrid_"+str(i)+"_buf")      arcpy.env.extent = grid     arcpy.env.mask = grid     print str(grid)     arcpy.env.workspace = DirTrees     Trees = arcpy.ListFeatureClasses("ProcGrid_"+str(i)+ "_*", "")     print str(Trees)     arcpy.CalculateField_management(Trees, "grid_code", 100, "", "") #this is line 47 


Some output shows the right file:
>>> Trees
[u'ProcGrid_1_buf_All_trees_1']

I've experimented with the list of Gridnums to see if that would matter, but using the range, or a list of numbers, nor the current method is working.

Any help or suggestions would be greatly appreciated.

Thanks

Rich

Outcomes