Select to view content in your preferred language

can't delete temporary layer in Python

1127
12
Jump to solution
10-24-2024 12:16 PM
PaulCone2
Frequent Contributor

I have temporary layer that I'm creating in a Pro Notebook. 

arcpy.MakeFeatureLayer_management(boec, r"memory\boecFL")

Once I'm done processing, I'm attempting to delete it, but I get an error message.  If I manually delete it, it works, but then when I copy that from the History as a Python snippet and try and run it, it fails.

arcpy.management.Delete(
in_data=r"memory\boecFL",
data_type="GPFeatureLayer"
)

WARNING 000110: memory\boecFL does not exist

I've tried various permutations for in_data and data_type.  Running Pro 3.1.7.  What am I missing?

 

 

0 Kudos
12 Replies
PaulCone2
Frequent Contributor

Because that's what Copy Snippet gave me.  I took it out and it works.  Seems like a common thing that Copy Snippet doesn't match what you should actually do in your code.  Anyway, thank you everyone for the help.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Huh, interesting.  It may be a defect in the Copy Snippet functionality.  I am glad it is working for you now.

0 Kudos
PaulCone2
Frequent Contributor

I'm still here!  Will give it a try.

0 Kudos