AnsweredAssumed Answered

64-bit ArcPy Not releasing Python Process on Completion

Question asked by emfulcher on Jun 11, 2020
Latest reply on Jun 24, 2020 by emfulcher

I'm using a command script to run an arcpy process on ArcMap 10.6 - 64-bit arcpy. On successfully completing the script, the process ends - but doesn't release/kill the python.exe (or pythonw.exe), therefore the bat script hangs and doesn't finish. In the script below, its the arcpy.mapping.ListDataFrames that causes the process to hang (that was fun narrowing down...). Comment it out and python terminates correctly. If i run this in 32 bit python terminates correctly - so just 64 bit. I'm thinking esri bug? Am I missing something?




Cleaned up script (may have missed something here) but it says the script is Finished.


import arcpy
import string
import gc

def main():
print("Completion Script is Starting")

mxd = arcpy.mapping.MapDocument("D:\WOBufferScripts\LeakSurveyScripts.mxd")
# Running this causes python to not close.
dataFrame = arcpy.mapping.ListDataFrames(mxd)[0]
del dataFrame
del mxd
print("Completion Script Has Finished")

if __name__ == "__main__":