the error associated with 'MdDlgContent.htm' has a long history, which I am sure you found by searching on GeoNet.
In short, the most commonly successful solution is to reset your profile Resetting your ArcGIS application profile
if you have ruled the browser issues identified in some of the related threads. If this only happens when you run your script, make sure that you are using IE as your browser and have it installed as a minimum since Internet Explorer is required for Arc* to work properly. I would skip the hassle and just reset by one of the recommended methods.
Retrieving data ...