I have a Python script that will successfully complete when run from the Python window in ArcMap or ArcCatalog, however, when I run as a standalone it will cause python.exe stopped working crash once it completes. I've tried from a command prompt and a couple different IDEs with the same result.
The target files and updates complete before the crash and when I compare the results from the stand alone script to the one run within the Python window they appear identical. I've placed print statements at various locations including on the last line to help with debugging and all of them print. Since the crash is happening after the all lines in the script have been run, I'm not sure how to further debug this. I'm running ArcGIS 10.5.1.
If I comment out the arcpy.CreateRapidGraphic line then the crash does not occur.
I'm primarily running via a command prompt
C:\Python27\ArcGIS10.5\python.exe D:\Projects\py\createmap.py
but have also tried double-clicking and running in visual studio code.
The last lines of my code are similar to this:
arcpy.CreateRapidGraphic_defense(geodb, areaOfInterestLyr, productType, version, mapDocumentWork, rasterLyr)
print "graphic done"
arcpy.CheckInExtension('defense')
arcpy.CheckInExtension('foundation')
arcpy.CheckInExtension('spatial')
arcpy.CheckInExtension('3D')
print "checkin done"