<?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: Arcpy script runs on server but not as a geoprocessing service in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029643#M60060</link>
    <description>&lt;P&gt;Thanks for the tip. The database connection was not registered with the Data Stores on the Server. We registered the connection, republished the service and are still getting an error. We also made sure that the server user has permissions on the folder. I looked at the file that was created when we published the tool and found this:&lt;/P&gt;&lt;P&gt;# Esri start of added variables&lt;BR /&gt;g_ESRI_variable_1 = u'..\\..\\..\\..\\..\\maptool\\tools\\spatialdb_spatialtest.sde\\spatialtest.name.name_si'&lt;BR /&gt;# Esri end of added variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;Any suggestions of what to try next?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 17:53:31 GMT</pubDate>
    <dc:creator>Strahanjen</dc:creator>
    <dc:date>2021-02-23T17:53:31Z</dc:date>
    <item>
      <title>Arcpy script runs on server but not as a geoprocessing service</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029618#M60057</link>
      <description>&lt;P&gt;We have an insert script that runs fine on our server. When we publish it as a geoprocessing service, we get this error:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RuntimeError: cannot open '..\..\..\..\..\maptool\tools\spatialdb_spatialtest.sde\spatialtest.name.name_si' Failed to execute&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In the script, the&amp;nbsp; connection looks like this:&lt;/P&gt;&lt;P&gt;fc = r"C:\apps\maptool\tools\spatialdb_spatialtest.sde\spatialtest.name.name_si"&lt;BR /&gt;cursor = arcpy.da.InsertCursor(fc, ("subject_item_id",&amp;nbsp; "address1", "address2", "city_name", "state_code", "zip_code"))&lt;/P&gt;&lt;P&gt;Any suggestions on how to troubleshoot and solve would much appreciated. I suspect the issue may be with the path?&amp;nbsp; I'm not sure why all of the ..\..\ are showing up in the error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 16:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029618#M60057</guid>
      <dc:creator>Strahanjen</dc:creator>
      <dc:date>2021-02-23T16:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script runs on server but not as a geoprocessing service</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029620#M60058</link>
      <description>&lt;P&gt;Is that database connection registered with the Data Store on Server?&lt;/P&gt;&lt;P&gt;&lt;A href="https://enterprise.arcgis.com/en/server/latest/manage-data/windows/registering-your-data-with-arcgis-server-using-manager.htm#ESRI_SECTION1_9D5CE649771049C6A0886A79E3C5B8AC" target="_blank" rel="noopener"&gt;Register your data with ArcGIS Server using Server Manager—ArcGIS Server | Documentation for ArcGIS Enterprise&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 14:14:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029620#M60058</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-02-24T14:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy script runs on server but not as a geoprocessing service</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029643#M60060</link>
      <description>&lt;P&gt;Thanks for the tip. The database connection was not registered with the Data Stores on the Server. We registered the connection, republished the service and are still getting an error. We also made sure that the server user has permissions on the folder. I looked at the file that was created when we published the tool and found this:&lt;/P&gt;&lt;P&gt;# Esri start of added variables&lt;BR /&gt;g_ESRI_variable_1 = u'..\\..\\..\\..\\..\\maptool\\tools\\spatialdb_spatialtest.sde\\spatialtest.name.name_si'&lt;BR /&gt;# Esri end of added variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;Any suggestions of what to try next?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 17:53:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-runs-on-server-but-not-as-a/m-p/1029643#M60060</guid>
      <dc:creator>Strahanjen</dc:creator>
      <dc:date>2021-02-23T17:53:31Z</dc:date>
    </item>
  </channel>
</rss>

