import arcpy
if arcpy.Exists("C:/Temp/Test.gdb"):
arcpy.Delete_management("C:/Temp/Test.gdb")
if arcpy.Exists("in_memory"):
arcpy.Delete_management("in_memory")
arcpy.CreateFileGDB_management("C:/Temp","test","CURRENT")
arcpy.CreateFishnet_management("C:/Temp/test.gdb/fishnetPolys","0 0","0 1","1","1","1","1","#","NO_LABELS","#","POLYGON")
fcs = arcpy.SearchCursor("C:/Temp/test.gdb/fishnetPolys")
for fc in fcs:
print fc.Shape_Area
print "Above came from Shape_Area field of polygon on disk"
del fc,fcs
arcpy.CopyFeatures_management("C:/Temp/test.gdb/fishnetPolys","in_memory/fishnetPolysInMemory")
arcpy.CopyFeatures_management("in_memory/fishnetPolysInMemory","C:/Temp/test.gdb/fishnetPolysBackOnDisk")
fcs = arcpy.SearchCursor("C:/Temp/test.gdb/fishnetPolysBackOnDisk")
for fc in fcs:
print fc.Shape_Area
print "Above came from Shape_Area field of polygon copied from disk to in_memory and back to disk"
del fc,fcs
fcs = arcpy.SearchCursor("in_memory/fishnetPolysInMemory")
for fc in fcs:
print fc.Shape_Area
print "Above came from Shape_Area field of polygon copied from disk to in_memory - but you should see error trying to access it"
del fc,fcsLooks like this issue is not resolved for 10.5.1 too. I had to do the similar thing of creating new field and calculating lengths. But its simpler to just get the attribute as is. I think ESRI has to look into fixing this, especially when in-memory is used for faster processing.
ESRI has issued Bug NIM063795 about this behavior. It occurs when the background processing is enabled.
Thanks Ken
However, for me it is not restricted to background geoprocessing.
- Graeme