AnsweredAssumed Answered

How to publish a mxd file via arcpy

Question asked by aleho123 on Jan 13, 2017
Latest reply on Jan 13, 2017 by khibma-esristaff



I want to publish a mxd file via arcpy. I checked the examples in the documentation - unfortunately it is not working. the code is:

sd_draft = arcpy.mapping.CreateMapSDDraft(map_document, sd_draft_file, service_name, "FROM_CONNECTION_FILE", connection_file, True, None, summary, tags)

if sd_draft["errors"] == {}:
    arcpy.StageService_server(sd_draft_file, sd_file)
    arcpy.UploadServiceDefinition_server(sd_file, connection_file)

at CreateMapSDDraft the following error occurs:
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\", line 398, in CreateMapSDDraft
    return convertArcObjectToPythonObject(arcgisscripting._createMapSDDraft(*gp_fixargs([map_document, out_sddraft, service_name, server_type, connection_file_path, copy_data_to_server, folder_name, summary, tags], True, False)))

Error Info:
The system cannot locate the object specified.

I checked - the paths to the connection file and the mxd file are correct. We are also running on the latest Version. But I cant find any sd files on the server for existing services. Any idea, why I cant find those files?


Any help, very welcome.