<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to publish a mxd file via arcpy in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558960#M3772</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm"&gt;CreateMapSDDraft—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;shows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A draft service definition does not contain data. A draft service alone cannot be used to publish a service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Service Definition Draft can then be converted to a fully consolidated Service Definition (.sd) file using the Stage Service tool. Staging compiles all the necessary information needed to successfully publish the GIS resource. If your data is not registered with the server, the data will be added when the Service Definition Draft is staged. Finally, the Service Definition file can be uploaded and published as a GIS service to a specified GIS server using the Upload Service Definition tool. This step takes the Service Definition file, copies it onto the server, extracts required information, and publishes the GIS resource. For more information, see the overview of the Publishing toolset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which suggests you aren't done the process&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jan 2017 11:45:05 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-01-13T11:45:05Z</dc:date>
    <item>
      <title>How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558957#M3769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to publish a mxd file via arcpy. I checked the examples in the documentation - unfortunately it is not working. the code is:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sd_draft = arcpy.mapping.CreateMapSDDraft(map_document, sd_draft_file, service_name, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"FROM_CONNECTION_FILE"&lt;/SPAN&gt;, connection_file, &lt;SPAN style="color: #000080;"&gt;True&lt;/SPAN&gt;, &lt;SPAN style="color: #000080;"&gt;None&lt;/SPAN&gt;, summary, tags)

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;sd_draft[&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"errors"&lt;/SPAN&gt;] == {}:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.StageService_server(sd_draft_file, sd_file)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.UploadServiceDefinition_server(sd_file, connection_file)

at CreateMapSDDraft the following error occurs:&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;STRONG&gt;File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\mapping.py", line 398, in CreateMapSDDraft&lt;/STRONG&gt;
&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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)))&lt;/STRONG&gt;

&lt;STRONG&gt;Error Info:&lt;/STRONG&gt;
&lt;STRONG&gt;The system cannot locate the object specified.&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help, very welcome.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:37:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558957#M3769</guid>
      <dc:creator>aleho123</dc:creator>
      <dc:date>2021-12-12T16:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558958#M3770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you define the "map_document" parameter?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 10:34:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558958#M3770</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2017-01-13T10:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558959#M3771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE style="background-color: #ffffff; color: #000000; font-family: 'Courier New'; font-size: 9,0pt;"&gt;map_document = arcpy.mapping.MapDocument(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"PATH\\TO_MXD_FILE&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 10:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558959#M3771</guid>
      <dc:creator>aleho123</dc:creator>
      <dc:date>2017-01-13T10:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558960#M3772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm"&gt;CreateMapSDDraft—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;shows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A draft service definition does not contain data. A draft service alone cannot be used to publish a service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Service Definition Draft can then be converted to a fully consolidated Service Definition (.sd) file using the Stage Service tool. Staging compiles all the necessary information needed to successfully publish the GIS resource. If your data is not registered with the server, the data will be added when the Service Definition Draft is staged. Finally, the Service Definition file can be uploaded and published as a GIS service to a specified GIS server using the Upload Service Definition tool. This step takes the Service Definition file, copies it onto the server, extracts required information, and publishes the GIS resource. For more information, see the overview of the Publishing toolset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which suggests you aren't done the process&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 11:45:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558960#M3772</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-01-13T11:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558961#M3773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes - of course. because the script failed before and didn't execute the following steps.&lt;/P&gt;&lt;P&gt;Which are as far as I know: arcpy.StageService_server and arcpy.UploadServiceDefinition_server&lt;/P&gt;&lt;P&gt;To call StageService_server I would need an existing sddraft - so, as long as the function CreateMapSDDraft fails, I am stuck there. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 11:53:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558961#M3773</guid>
      <dc:creator>aleho123</dc:creator>
      <dc:date>2017-01-13T11:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to publish a mxd file via arcpy</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558962#M3774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anna, I think you'll need to add a little more of your code to the question.&lt;/P&gt;&lt;P&gt;My best guess is it cant find one of: 1) input MXD 2) output location for the .SDDRAFT file or 3) the .AGS connection file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2017 17:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-publish-a-mxd-file-via-arcpy/m-p/558962#M3774</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2017-01-13T17:48:58Z</dc:date>
    </item>
  </channel>
</rss>

