I tried to automate the overwriting of an existing map service using a stand-alone Python script.
I mirrored the Esri's sample scripts. But when I ran it, the second print statement was never executed. However, when I ran the same script from the Python window inside ArcMap, the script ran as expected.
import arcpy wrkspc = 'C:/GIS_Projects/' mxd_name = 'Test.mxd' mxd = arcpy.mapping.MapDocument(wrkspc + mxd_name) server_con = 'GIS Servers/arcgis on myserver_6443 (admin)' service = 'Test' sddraft = wrkspc + service + '.sddraft' sd_file = wrkspc + service + '.sd' print 'local variables set' analysis = arcpy.mapping.CreateMapSDDraft(mxd, sddraft, service, 'ARCGIS_SERVER', server_con, True, None, 'test', 'test') print 'SDdraft file created'