<?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: Errors in GP Tool when executed within C# application in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1227957#M66000</link>
    <description>&lt;P&gt;ERROR &lt;SPAN class=""&gt;000210&lt;/SPAN&gt;: Cannot &lt;SPAN class=""&gt;create&lt;/SPAN&gt; &lt;SPAN class=""&gt;output&lt;/SPAN&gt; -&lt;/P&gt;&lt;P&gt;Instead of the %scratchfolder%, try outputting it to an existing folder and make sure that you (or the c# application) can create the output there. If that works, you can start looking at alternatives or look into getting the %scratchfolder% to work.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 15:55:27 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2022-11-02T15:55:27Z</dc:date>
    <item>
      <title>Errors in GP Tool when executed within C# application</title>
      <link>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1227936#M65999</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I have a custom geoprocessing task written for me in python that takes 2 inputs - input_rows.csv and event_rows.csv - and creates a file gdb with a feature class of a join of these 2 tables.&lt;/P&gt;&lt;P&gt;input_rows has the x,y coordinates for the feature class. event_rows.csv contains the attributes.&lt;/P&gt;&lt;P&gt;When I run it locally in ArcCatalog (10.7.1), it runs fine. If I publish it to our ArcGIS 10.81 Linux server and run that in ArcCatalog, it also runs fine. If I try to execute it thru a call in my C# application, I get a generic error on TableToTable_conversion:&lt;/P&gt;&lt;PRE&gt;&amp;lt;Msg &lt;SPAN class=""&gt;time&lt;/SPAN&gt;='&lt;SPAN class=""&gt;2022&lt;/SPAN&gt;-&lt;SPAN class=""&gt;10&lt;/SPAN&gt;-&lt;SPAN class=""&gt;25&lt;/SPAN&gt;T13:&lt;SPAN class=""&gt;01&lt;/SPAN&gt;:&lt;SPAN class=""&gt;43&lt;/SPAN&gt;,&lt;SPAN class=""&gt;305&lt;/SPAN&gt;' &lt;SPAN class=""&gt;type&lt;/SPAN&gt;=&lt;SPAN class=""&gt;'SEVERE&lt;/SPAN&gt;' code='&lt;SPAN class=""&gt;20010&lt;/SPAN&gt;' target=&lt;SPAN class=""&gt;'export&lt;/SPAN&gt;/Download_v3.GPServer' methodName=&lt;SPAN class=""&gt;'GPServerSync&lt;/SPAN&gt;.CheckMessages' machine=&lt;SPAN class=""&gt;'xxx&lt;/SPAN&gt;' &lt;SPAN class=""&gt;process&lt;/SPAN&gt;='&lt;SPAN class=""&gt;116658&lt;/SPAN&gt;' thread='&lt;SPAN class=""&gt;505&lt;/SPAN&gt;' user=&lt;SPAN class=""&gt;'null&lt;/SPAN&gt;'  requestId=&lt;SPAN class=""&gt;'xxx&lt;/SPAN&gt;'&amp;gt;&lt;SPAN class=""&gt;Error&lt;/SPAN&gt; executing tool. Download Job ID: j46c9f46dd97642e4890778604255a1fb : 
Traceback (most recent call last):
  &lt;SPAN class=""&gt;File&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;line&lt;/SPAN&gt; &lt;SPAN class=""&gt;248&lt;/SPAN&gt;, &lt;SPAN class=""&gt;in&lt;/SPAN&gt; execute
  &lt;SPAN class=""&gt;File&lt;/SPAN&gt; &lt;SPAN class=""&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;line&lt;/SPAN&gt; &lt;SPAN class=""&gt;190&lt;/SPAN&gt;, &lt;SPAN class=""&gt;in&lt;/SPAN&gt; zip_GIS
  &lt;SPAN class=""&gt;File&lt;/SPAN&gt; &lt;SPAN class=""&gt;"z:\home\esri\arcgis\server\arcpy\arcpy\conversion.py"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;line&lt;/SPAN&gt; &lt;SPAN class=""&gt;2272&lt;/SPAN&gt;, &lt;SPAN class=""&gt;in&lt;/SPAN&gt; TableToTable
    raise e
ExecuteError: &lt;SPAN class=""&gt;ERROR&lt;/SPAN&gt; &lt;SPAN class=""&gt;999999&lt;/SPAN&gt;: &lt;SPAN class=""&gt;Error&lt;/SPAN&gt; executing &lt;SPAN class=""&gt;function&lt;/SPAN&gt;.
Failed &lt;SPAN class=""&gt;to&lt;/SPAN&gt; execute (TableToTable).&lt;/PRE&gt;&lt;P&gt;Here is the code to do the conversion:&lt;/P&gt;&lt;PRE&gt;x_coords = &lt;SPAN class=""&gt;"S4_X"&lt;/SPAN&gt;
y_coords = &lt;SPAN class=""&gt;"S4_Y"&lt;/SPAN&gt;
out_event_lyr = &lt;SPAN class=""&gt;"event_layer"&lt;/SPAN&gt;

v_scratchFolder&lt;SPAN class=""&gt;_&lt;/SPAN&gt; = &lt;SPAN class=""&gt;"%scratchFolder%"

# create Folder
arcpy.CreateFolder_management(v_scratchFolder_, "&lt;/SPAN&gt;Geodatabase&lt;SPAN class=""&gt;")

# create File GDB
arcpy.CreateFileGDB_management(x, gdb_name)

wkt = "&lt;/SPAN&gt;PROJCS[&lt;SPAN class=""&gt;'NAD_1983_HARN_Florida_GDL_Albers'&lt;/SPAN&gt;,GEOGCS[&lt;SPAN class=""&gt;'GCS_North_American_1983_HARN'&lt;/SPAN&gt;,DATUM[&lt;SPAN class=""&gt;'D_North_American_1983_HARN'&lt;/SPAN&gt;,SPHEROID[&lt;SPAN class=""&gt;'GRS_1980'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;6378137.0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;298.257222101&lt;/SPAN&gt;]],PRIMEM[&lt;SPAN class=""&gt;'Greenwich'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;.&lt;SPAN class=""&gt;0&lt;/SPAN&gt;],UNIT[&lt;SPAN class=""&gt;'Degree'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;.&lt;SPAN class=""&gt;0174532&lt;/SPAN&gt;925199433]],PROJECTION[&lt;SPAN class=""&gt;'Albers'&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'False_Easting'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;400000.0&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'False_Northing'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;.&lt;SPAN class=""&gt;0&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'Central_Meridian'&lt;/SPAN&gt;,-&lt;SPAN class=""&gt;84.0&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'Standard_Parallel_1'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;24.0&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'Standard_Parallel_2'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;31.5&lt;/SPAN&gt;],PARAMETER[&lt;SPAN class=""&gt;'Latitude_Of_Origin'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;24.0&lt;/SPAN&gt;],UNIT[&lt;SPAN class=""&gt;'Meter'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;1.0&lt;/SPAN&gt;],AUTHORITY[&lt;SPAN class=""&gt;'EPSG'&lt;/SPAN&gt;,&lt;SPAN class=""&gt;3087&lt;/SPAN&gt;]]&lt;SPAN class=""&gt;"
sr = arcpy.SpatialReference()
sr.loadFromString(wkt)

out_event_lyr = arcpy.MakeXYEventLayer_management(input_rows, x_coords, y_coords, out_event_lyr, sr)
crash_fc = arcpy.CopyFeatures_management(out_event_lyr, os.path.join("&lt;/SPAN&gt;%scratchFolder%\Geodatabase&lt;SPAN class=""&gt;", gdb_name, out_event_fc))

event_tab = arcpy.TableToTable_conversion(event_rows, os.path.join("&lt;/SPAN&gt;%scratchFolder%\Geodatabase&lt;SPAN class=""&gt;", gdb_name), "&lt;/SPAN&gt;EventTab&lt;SPAN class=""&gt;")

crash_fc_lyr = arcpy.MakeFeatureLayer_management(crash_fc, "&lt;/SPAN&gt;fc_lyr&lt;SPAN class=""&gt;")
out_event_lyr_join = arcpy.AddJoin_management(crash_fc_lyr, "&lt;/SPAN&gt;REPORT_NUMBER&lt;SPAN class=""&gt;", event_tab, "&lt;/SPAN&gt;REPORT_NUMBER&lt;SPAN class=""&gt;")

arcpy.CopyFeatures_management(out_event_lyr_join, os.path.join("&lt;/SPAN&gt;%scratchFolder%\Geodatabase&lt;SPAN class=""&gt;", gdb_name, out_event_fc1))&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;We changed the script to do a CopyFeatures instead of TableToTable to see if that would work but I get a different error:&lt;/P&gt;&lt;PRE&gt;ExecuteError: ERROR &lt;SPAN class=""&gt;000210&lt;/SPAN&gt;: Cannot &lt;SPAN class=""&gt;create&lt;/SPAN&gt; &lt;SPAN class=""&gt;output&lt;/SPAN&gt; Z:\opt\esri\arcgis\server\usr\directories\arcgisjobs\export\download_v3_1_gpserver\j46744155824f44e1ad5f7c1a1a6afc71\scratch\Geodatabase\s4_mapped_crashes_gdb.gdb\att
Failed to &lt;SPAN class=""&gt;execute&lt;/SPAN&gt; (CopyFeatures).&lt;/PRE&gt;&lt;P&gt;Here is the CopyFeature version:&lt;/P&gt;&lt;PRE&gt;x_coords = &lt;SPAN class=""&gt;"S4_X"&lt;/SPAN&gt;
y_coords = &lt;SPAN class=""&gt;"S4_Y"&lt;/SPAN&gt;
out_event_lyr = &lt;SPAN class=""&gt;"event_layer"&lt;/SPAN&gt;

v_scratchFolder_ = &lt;SPAN class=""&gt;"%scratchFolder%"&lt;/SPAN&gt;
Geodatabase = v_scratchFolder_
s4_crash_gdb_gdb = Geodatabase

&lt;SPAN class=""&gt;# create Folder&lt;/SPAN&gt;
x = arcpy.CreateFolder_management(v_scratchFolder_, &lt;SPAN class=""&gt;"Geodatabase"&lt;/SPAN&gt;)
arcpy.AddMessage(x)

&lt;SPAN class=""&gt;# create File GDB&lt;/SPAN&gt;
arcpy.CreateFileGDB_management(x, gdb_name)

wkt = &lt;SPAN class=""&gt;"PROJCS['NAD_1983_HARN_Florida_GDL_Albers',GEOGCS['GCS_North_American_1983_HARN',DATUM['D_North_American_1983_HARN',SPHEROID['G RS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-84.0],PARAMETER['Standard_Parallel_1',24.0],PARAMETER['Standard_Parallel_2',31.5],PARAMETER['Latitude_Of_Origin',24.0],UNIT['Meter',1.0],AUTHORITY['EPSG',3087]]"&lt;/SPAN&gt;
sr = arcpy.SpatialReference()
sr.loadFromString(wkt)

&lt;SPAN class=""&gt;# create GIS file in geodatabase&lt;/SPAN&gt;
out_event_lyr = arcpy.MakeXYEventLayer_management(input_rows, x_coords, y_coords, out_event_lyr, sr)
crash_fc = arcpy.CopyFeatures_management(out_event_lyr, os.path.join(&lt;SPAN class=""&gt;"%scratchFolder%\Geodatabase"&lt;/SPAN&gt;, gdb_name, out_event_fc))
crash_fc_lyr = arcpy.MakeFeatureLayer_management(crash_fc, &lt;SPAN class=""&gt;"fc_lyr"&lt;/SPAN&gt;)
out_event_lyr_join = arcpy.AddJoin_management(crash_fc_lyr, &lt;SPAN class=""&gt;"REPORT_NUMBER"&lt;/SPAN&gt;, event_rows, &lt;SPAN class=""&gt;"REPORT_NUMBER"&lt;/SPAN&gt;)

arcpy.CopyFeatures_management(out_event_lyr_join, os.path.join(&lt;SPAN class=""&gt;"%scratchFolder%\Geodatabase"&lt;/SPAN&gt;, gdb_name, out_event_fc1))&lt;/PRE&gt;&lt;P&gt;My ArcGIS and Python skills are pretty rudimentary so I'm struggling trying to figure out what the issue is. I've been at it for almost 2 weeks! Doesn't seem like an unreasonable task I'm trying to accomplish but it has me stumped. What am I missing?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:34:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1227936#M65999</guid>
      <dc:creator>MarniFowler</dc:creator>
      <dc:date>2022-11-02T15:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Errors in GP Tool when executed within C# application</title>
      <link>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1227957#M66000</link>
      <description>&lt;P&gt;ERROR &lt;SPAN class=""&gt;000210&lt;/SPAN&gt;: Cannot &lt;SPAN class=""&gt;create&lt;/SPAN&gt; &lt;SPAN class=""&gt;output&lt;/SPAN&gt; -&lt;/P&gt;&lt;P&gt;Instead of the %scratchfolder%, try outputting it to an existing folder and make sure that you (or the c# application) can create the output there. If that works, you can start looking at alternatives or look into getting the %scratchfolder% to work.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1227957#M66000</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-02T15:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Errors in GP Tool when executed within C# application</title>
      <link>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1229324#M66036</link>
      <description>&lt;P&gt;Thanks. I've gotten pulled off onto another task but will give this a try once that is complete.&amp;nbsp; It doesn't make sense because this is the exact same script we've been using for a good while. The only difference is we're trying to do the join to get more attributes.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 20:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/errors-in-gp-tool-when-executed-within-c/m-p/1229324#M66036</guid>
      <dc:creator>MarniFowler</dc:creator>
      <dc:date>2022-11-07T20:20:51Z</dc:date>
    </item>
  </channel>
</rss>

