Hello! I am working on a script that will archive layers from AGOL in a zipped geodatabase. When I get to the clean up section, the script fails, because it can't delete a geodatabase with a lock in it. The lock is created during the script processes, so it's not being used by another user. Is there a way to release the lock in the same script? Here's my general workflow:
1. Log in to AGOL
2. Create a geodatabase
3. Copy layers from AGOL to the geodatabase
4. Zip the geodatabase
5. Delete the unzipped geodatabase (script fails here due to lock)
I'm very new to python, fyi. 🙂 Any help is appreciated!
Solved! Go to Solution.
Update, I fixed the problem by using arpy.management.Delete() instead of os.remove()
Thanks for the input!
The lock will not be released until the script is done. You can use arcpy.env.overwriteOut = True to simply overwrite the existing gdb's namespace the next time the script is run. Sometimes a bit of fluff lies around if you don't want to delete things manually or in a separate script
Update, I fixed the problem by using arpy.management.Delete() instead of os.remove()
Thanks for the input!