Wednesday 24 July 2019

geoprocessing - arcpy.MakeFeatureLayer in-memory layer still exists when subsequent step fails during testing


When I used arcgisscripting to create in-memory output layer with gp.makefeaturelayer, I would put it in a try/except block and delete the gp object in the except piece when the makefeaturelayer would fail. Now when I am using arcpy, it looks like I need to close the idle window and open again in order to get the in-memory output layer to get deleted.


How could I have the output layer from my makefeaturelayer tool get deleted in a try/except block? Thanks.




Answer



arcpy.Delete_management(featureLayer)

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...