<?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 Publish a Web tools in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/publish-a-web-tools/m-p/747280#M57776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing to request technical assistance. I created a python script that needs to execute the following, in the indicated order:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) generate some rasters,&lt;/P&gt;&lt;P&gt;2) add the rasters to a map&lt;/P&gt;&lt;P&gt;3) publish the map as a MAP_IMAGE to an ArcGIS Server federated with a Portal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I published the python script to ArcGis Server as a Web Tool, so I can later use it from a web app as a REST Service.&lt;/P&gt;&lt;P&gt;The problem I am experiencing is: Once the webtool is created and I try to execute it as a rest service from the browser I get errors. Please see below for Code Version 1 and its errors and Code Version 2 and its errors;&lt;/P&gt;&lt;P&gt;Version 1&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## Version 1 - Using map.getWebLayerSharingDraft&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft = _work_map.getWebLayerSharingDraft('FEDERATED_SERVER', 'MAP_IMAGE', service)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.federatedServerUrl = str(svr_fed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.summary = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.tags = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.description = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.credits = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.useLimitations = 'My Use Limitations'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.copyDataToServer = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.offline = False&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.overwriteExistingService = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## End Version 1&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;'Map' object has no attribute 'getWebLayerSharingDraft'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version 2&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## Version 2 - Using arcpy.sharing.CreateSharingDraft&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft = arcpy.sharing.CreateSharingDraft("STANDALONE_SERVER", "MAP_SERVICE", service, _work_map)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.targetServer = svr_fed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.summary = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.tags = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.description = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.credits = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.useLimitations = 'My Use Limitations'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.copyDataToServer = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.offline = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.overwriteExistingService = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## End Version 2&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;module 'arcpy' has no attribute 'sharing'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Both versions run perfectly in ArcGis Pro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS version: Pro 2.3.0, Python version: 3.6.6&lt;/P&gt;&lt;P&gt;Python version on ArcGis Server: 2.7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some Links consulted;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapservicedraft-class.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapservicedraft-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/223789-getweblayersharingdraft-not-found"&gt;https://community.esri.com/thread/223789-getweblayersharingdraft-not-found&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2019 23:49:00 GMT</pubDate>
    <dc:creator>DamasoAvalos_Ruiz1</dc:creator>
    <dc:date>2019-02-22T23:49:00Z</dc:date>
    <item>
      <title>Publish a Web tools</title>
      <link>https://community.esri.com/t5/python-questions/publish-a-web-tools/m-p/747280#M57776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing to request technical assistance. I created a python script that needs to execute the following, in the indicated order:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) generate some rasters,&lt;/P&gt;&lt;P&gt;2) add the rasters to a map&lt;/P&gt;&lt;P&gt;3) publish the map as a MAP_IMAGE to an ArcGIS Server federated with a Portal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I published the python script to ArcGis Server as a Web Tool, so I can later use it from a web app as a REST Service.&lt;/P&gt;&lt;P&gt;The problem I am experiencing is: Once the webtool is created and I try to execute it as a rest service from the browser I get errors. Please see below for Code Version 1 and its errors and Code Version 2 and its errors;&lt;/P&gt;&lt;P&gt;Version 1&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## Version 1 - Using map.getWebLayerSharingDraft&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft = _work_map.getWebLayerSharingDraft('FEDERATED_SERVER', 'MAP_IMAGE', service)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.federatedServerUrl = str(svr_fed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.summary = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.tags = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.description = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.credits = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.useLimitations = 'My Use Limitations'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.copyDataToServer = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.offline = False&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.overwriteExistingService = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## End Version 1&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;'Map' object has no attribute 'getWebLayerSharingDraft'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version 2&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## Version 2 - Using arcpy.sharing.CreateSharingDraft&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft = arcpy.sharing.CreateSharingDraft("STANDALONE_SERVER", "MAP_SERVICE", service, _work_map)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.targetServer = svr_fed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.summary = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.tags = _work_map.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.description = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.credits = 'Create Rasters'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.useLimitations = 'My Use Limitations'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.copyDataToServer = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.offline = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sharing_draft.overwriteExistingService = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # ## End Version 2&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;module 'arcpy' has no attribute 'sharing'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Both versions run perfectly in ArcGis Pro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS version: Pro 2.3.0, Python version: 3.6.6&lt;/P&gt;&lt;P&gt;Python version on ArcGis Server: 2.7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some Links consulted;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapservicedraft-class.htm"&gt;https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapservicedraft-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/thread/223789-getweblayersharingdraft-not-found"&gt;https://community.esri.com/thread/223789-getweblayersharingdraft-not-found&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2019 23:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publish-a-web-tools/m-p/747280#M57776</guid>
      <dc:creator>DamasoAvalos_Ruiz1</dc:creator>
      <dc:date>2019-02-22T23:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a Web tools</title>
      <link>https://community.esri.com/t5/python-questions/publish-a-web-tools/m-p/747281#M57777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess is (I had a similar experience with other modules from arcpy) that the modules are called slightly differently in Python 3 compared to Python 2.7. If you can, I would suggest to add the python 3 to your server. If it is a Linux, this document might help:&amp;nbsp;&lt;A class="link-titled" href="https://enterprise.arcgis.com/en/server/10.7/administer/linux/linux-python.htm" title="https://enterprise.arcgis.com/en/server/10.7/administer/linux/linux-python.htm"&gt;Python 3 runtime for ArcGIS Server on Linux—ArcGIS Server Administration (Linux) | Documentation for ArcGIS Enterprise&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To test it you could run it in ArcMap (if you have that available) which uses 2.7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The &lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-family: &amp;amp;quot; consolas&amp;amp;quot;,&amp;amp;quot;andale mono&amp;amp;quot;,&amp;amp;quot;lucida console&amp;amp;quot;,&amp;amp;quot;monaco&amp;amp;quot;,monospace; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;arcpy.sharing&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; module was introduced at &lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;ArcGIS Pro&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; 2.2 to provide a better experience when sharing &lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/help/sharing/overview/introduction-to-sharing-web-layers.htm" style="color: #0074b8; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;web layers&lt;/A&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; over the previously existing function &lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-family: &amp;amp;quot; consolas&amp;amp;quot;,&amp;amp;quot;andale mono&amp;amp;quot;,&amp;amp;quot;lucida console&amp;amp;quot;,&amp;amp;quot;monaco&amp;amp;quot;,monospace; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/createweblayersddraft.htm" style="color: #0074b8; text-decoration: none;"&gt;CreateWebLayerSDDraft&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f8f8; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;. The original function is provided only for backward compatibility.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;so I assume, this is a new module and not yet available in 2.7 which would explain the error for option 2.&lt;/P&gt;&lt;P&gt;For option 1 I know that the schema of the map project - map - layer is very different compared to mxd - dataframe - layer so this is also related to Python 2.7 vs 3 I'm afraid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2020 21:28:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/publish-a-web-tools/m-p/747281#M57777</guid>
      <dc:creator>Nicole_Ueberschär</dc:creator>
      <dc:date>2020-03-17T21:28:58Z</dc:date>
    </item>
  </channel>
</rss>

