AnsweredAssumed Answered

UpdateCursor in ArcGIS Geoprocessing service not working!

Question asked by alexander.winz@deutschebahn.com on Sep 7, 2020
Latest reply on Sep 7, 2020 by bixb0012

Dear community,

 

I am working right now on one ExtractData Script for ArcGIS Server. I actually uses the "ExtractData" Tool form the server Tools.

 

Meanwhile this script create a zipfolder and within this zipfolder an geodatabase (in%Srcatch% of AGS). Now I try to Add a new Field to the FeatureClass to recalculate the subtypes of the fc. This works fine. When I try to use a update.cursor it works fine on my desktop, but as soon i publish it. I get an ERROR:

 

ARCGIS Server Manager:

Error executing tool. Model2 Job ID: jfcb1e7ba32e7428081ca616dbb174c06 : 1 Failed to execute (SubtypeExport). Failed to execute (Model2). Failed to execute (200820_SubtypeExport).

 

When I comment the UpdateCursor, my script works fine!

Line

def releaseDomains(output_gdb, output_feature_class_name):

arcpy.env.workspace = output_gdb
# Process: Add Field
arcpy.AddField_management(output_feature_class_name, "Oberkategorie_O", "TEXT", 9, "", "100", "Oberkategorie", "NULLABLE", "REQUIRED")
desc_lu = {}
domains = {}
for (key, value) in arcpy.da.ListSubtypes(output_feature_class_name).iteritems():
    desc_lu[key] = value['Name']

dropFields = ("Hauptkategorie_ST") #, "Biotopcodes_Unterkategorie")
subtypes = []
for h in desc_lu:
   subtypes.append(h)

for subt in subtypes:

try:
with arcpy.da.UpdateCursor(output_feature_class_name,("Hauptkategorie_ST",
"Oberkategorie_O")) as cursor:
   for row in cursor:
      row[1] = (desc_lu[row[0]])
      cursor.updateRow(row)
except:

arcpy.ClearWorkspaceCache_management()

# Delete the old fields


arcpy.RemoveSubtype_management (output_feature_class_name, subtypes)
arcpy.DeleteField_management(output_feature_class_name, dropFields)

 

 

Any idea? I stuck since 2 weeks on this stup....problem.

 

Thanks,

 

Alex

 

( I attached the whole script)

Outcomes