If I run this code:
import arcpy
import os
def main():
in_gdb = 'test_arc_interface.gdb'
in_features = os.path.join(in_gdb, 'section_grid')
in_raster = os.path.join(in_gdb, 'bitumen')
arcpy.ResetEnvironments()
arcpy.CheckOutExtension('Spatial')
arcpy.env.workspace = in_gdb
f_raster = arcpy.PolygonToRaster_conversion(in_features, 'OBJECTID', 'in_memory/f_raster', 'MAXIMUM_AREA')
table = arcpy.sa.ZonalStatisticsAsTable(f_raster, 'Value', in_raster, 'in_memory/r_table')
print(arcpy.Delete_management(table))
print(arcpy.Delete_management(f_raster))
print(arcpy.Exists(table))
print(arcpy.Exists(f_raster))
arcpy.env.workspace = 'in_memory'
print(arcpy.ListRasters())
print(arcpy.ListFeatureClasses())
if __name__ == '__main__':
main()I get:
true
true
False
True
['f_raster']
[]
i.e. Delete_management(f_raster) returns true, Exists(f_raster) returns false, but arcpy still lists it in ListRasters(). What is going on?