When running a simple Python script which is using ArcPy:
- The script is hanging but only in one machine and not in another machine. 
- The two machines are VMs and have the same specifications: Windows server 2016, and we connect with RDP 
- The script is hanging only if running through command line but it is not hanging if running through IDE. 
- The script is not hanging as soon as we remove any action on the mxd object, such as mxd.save() below. I.E., if removing mxd.save() from the script below, it is not hanging anymore. 
- The "modified date" property of the MXD file does get updated 
- Only Python 2.7 is installed in the machine ("C:\Python27\ArcGIS10.6\python.exe") 
- We tried suggestions in this answer to Python script hanging forever in Pycharm with import arcpy but to no avail 
- We tried to disable AntiVirus, after looking at the ProcMon reports, but to no avail. 
The script that is hanging is the below:
import arcpy
map_name = "C:/Test_Folder/Test.mxd"
mxd = arcpy.mapping.MapDocument(map_name)
mxd.save()
print("try")
del mxd
print("finally")
The screenshot of the hanging cmd window is the below:
Could anyone suggest any further troubleshooting to explore?


