Select to view content in your preferred language

How do you force a GP tool to release it's output

998
2
04-03-2013 12:43 AM
KimOllivier
Honored Contributor
I can see that I get a file lock on the KMZ output file after using MapToKML_conversion while still in the script, or still in Pythonwin. (I can't rename it, delete it etc). 10.1 SP1.
My workflow exports the map to a KMZ and then needs to upzip the file to extract the doc.kml inside.
If I re-run the script without editing I trip up on this file lock.

If I exit Pythonwin something cleans up the lock, so what could I do inside the script?
I have tried a del arcpy without success. Some people have success by encapsulating the tool in a function.
Sometimes an arcpy.RefreshCatalog() works with featureclasses, but in this case it is a system file.

A with... gpTool: would be nice!
Maybe it is just another Annoyance.
Tags (2)
0 Kudos
2 Replies
ChrisSnyder
Honored Contributor
A last ditch idea: subprocess the gp command? As the subprocess ends, so does the lock.
0 Kudos
SarahSchwarzer2
Emerging Contributor
Have you found a way to resolve this? I'm having a similar issue with a shapefile after using arcpy.ImportMetadata_conversion. The lock persists until I close Pythonwin and using del arcpy doesn't help.
0 Kudos