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?
Thanks,
Eric
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
gc.collect()
print("Completion Script Has Finished")
if __name__ == "__main__":
main()