<?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: Publishing ArcGIS API python script as a geoprocessing tool in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782475#M1260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Server does not contain the ArcGIS API for Python library and that would explain why it's failing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Jul 2017 01:03:35 GMT</pubDate>
    <dc:creator>RohitSingh2</dc:creator>
    <dc:date>2017-07-28T01:03:35Z</dc:date>
    <item>
      <title>Publishing ArcGIS API python script as a geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782474#M1259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to publish a geoprocessing tool from Pro using a python script and the ArcGIS API for Python. &amp;nbsp;The script is very simple and works well from Pro, but it will not publish to either of my Server sites, one which is hosted. &amp;nbsp;Is it not possible to publish using this new API to Server? &amp;nbsp;Can it only be used from the local workstation python interface and/or Pro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;from &lt;/SPAN&gt;arcgis.gis &lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;GIS
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;shutil, os, arcpy

newPolyName = arcpy.GetParameterAsText(&lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# Layer name
&lt;/SPAN&gt;featureType = arcpy.GetParameterAsText(&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# Feature type:&amp;nbsp; Point, Line or Polygon
&lt;/SPAN&gt;userName = arcpy.GetParameterAsText(&lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# User login
&lt;/SPAN&gt;pword = arcpy.GetParameterAsText(&lt;SPAN style="color: #0000ff;"&gt;3&lt;/SPAN&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;# User password
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gis = GIS(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;&lt;SPAN&gt;r"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fgis.cdatribe-nsn.gov%2Farcgisportal" target="_blank"&gt;https://gis.cdatribe-nsn.gov/arcgisportal&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;, userName, pword)

newShapeFileName = &lt;SPAN style="color: #008080; font-weight: bold;"&gt;r"\\gis-bj\E\Data\AutoPublishUTMLayer\OutputShapefile" &lt;/SPAN&gt;+ &lt;SPAN style="color: #000080;"&gt;chr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;92&lt;/SPAN&gt;) + newPolyName + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;".shp"
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;print&lt;/SPAN&gt;(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'copy \\gis-bj\E\Data\AutoPublishUTMLayer\Empty' &lt;/SPAN&gt;+ featureType + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'UTM.* \\gis-bj\E\Data\AutoPublishUTMLayer\OutputShapefile' &lt;/SPAN&gt;+ &lt;SPAN style="color: #000080;"&gt;chr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;92&lt;/SPAN&gt;) + newPolyName + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;'.*'&lt;/SPAN&gt;)
os.system(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'copy \\gis-bj\E\Data\AutoPublishUTMLayer\Empty' &lt;/SPAN&gt;+ featureType + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'UTM.* \\gis-bj\E\Data\AutoPublishUTMLayer\OutputShapefile' &lt;/SPAN&gt;+ &lt;SPAN style="color: #000080;"&gt;chr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;92&lt;/SPAN&gt;) + newPolyName + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;'.*'&lt;/SPAN&gt;)
shutil.make_archive(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;r"\\gis-bj\E\Data\AutoPublishUTMLayer" &lt;/SPAN&gt;+ &lt;SPAN style="color: #000080;"&gt;chr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;92&lt;/SPAN&gt;) + newPolyName, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;'zip'&lt;/SPAN&gt;, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;r"\\gis-bj\E\Data\AutoPublishUTMLayer\OutputShapefile"&lt;/SPAN&gt;)

data = &lt;SPAN style="color: #008080; font-weight: bold;"&gt;r"\\gis-bj\E\Data\AutoPublishUTMLayer" &lt;/SPAN&gt;+ &lt;SPAN style="color: #000080;"&gt;chr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;92&lt;/SPAN&gt;) + newPolyName&amp;nbsp; + &lt;SPAN style="color: #008080; font-weight: bold;"&gt;".zip"
&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;print&lt;/SPAN&gt;(data)
shpfile = gis.content.add({}, data)
published_service = shpfile.publish({&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"name"&lt;/SPAN&gt;: newPolyName,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"targetSR"&lt;/SPAN&gt;:{&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"wkid"&lt;/SPAN&gt;:&lt;SPAN style="color: #0000ff;"&gt;26911&lt;/SPAN&gt;}})

os.system(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'del /q \\gis-bj\E\Data\AutoPublishUTMLayer\OutputShapefile\*.*'&lt;/SPAN&gt;)
os.system(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;r'del /q \\gis-bj\E\Data\AutoPublishUTMLayer\*.zip'&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:54:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782474#M1259</guid>
      <dc:creator>BerneJackson</dc:creator>
      <dc:date>2021-12-12T08:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing ArcGIS API python script as a geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782475#M1260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Server does not contain the ArcGIS API for Python library and that would explain why it's failing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 01:03:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782475#M1260</guid>
      <dc:creator>RohitSingh2</dc:creator>
      <dc:date>2017-07-28T01:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing ArcGIS API python script as a geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782476#M1261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this something that is going to be implemented in Server Enterprise?&amp;nbsp; It's something I could &lt;EM&gt;&lt;STRONG&gt;really&lt;/STRONG&gt; &lt;/EM&gt;use right now.&amp;nbsp; It's been literally several years now I've been waiting for the capabilities that the ArcGIS API for Python has.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 15:25:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782476#M1261</guid>
      <dc:creator>BerneJackson</dc:creator>
      <dc:date>2017-07-28T15:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing ArcGIS API python script as a geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782477#M1262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would second this - would love to know if/when ArcGIS Server will support the ArcGIS API. I would love to take advantage of the layout and symbology control that the API brings but in a GP service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone able to provide some info on whether this is on the roadmap for ESRI?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Sep 2017 04:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-arcgis-api-python-script-as-a/m-p/782477#M1262</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2017-09-13T04:40:53Z</dc:date>
    </item>
  </channel>
</rss>

