AnsweredAssumed Answered

PLEASE HELP! Features do not get updated in Geoprocessing Service

Question asked by ionarawilson on Oct 11, 2013
Latest reply on Oct 17, 2013 by ionarawilson
I am at my wits end with this and it seems that ESRI does not provide much information about this. My data is in SDE. This script works in ArcMap but it does not update the features when it is run with a geoprocessing service. I don't think I can write an absolute path for the inputs as this gp will be used in a web app. Can anybody help?

# Import arcpy module import os, sys, arcpy, traceback, arcgisscripting  arcpy.env.workspace = "Database Connections\\sars.sde\\" arcpy.env.scratchWorkspace = "d:\\ArcGISData\\SARS\\Python_10April2013\\SARS.gdb"   Input_Polygons = arcpy.GetParameterAsText(0) Counties = arcpy.GetParameterAsText(1)  # create output feature for spatial join if os.path.exists("d:\\ArcGISData\\SARS\\Python_10April2013\\SARS.gdb\\StewardshipCounties"):     os.remove("d:\\ArcGISData\\SARS\\Python_10April2013\\SARS.gdb\\StewardshipCounties") outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")   with arcpy.da.UpdateCursor(Input_Polygons, ("DateStart", "PlanID", "FFY")) as rows:               for row in rows:          if not (row[1] or "").strip(): #covers blank, one blank space, or Null             Datestarstr1 = row[0]             Datestarstr2 = str(Datestarstr1)                      yearonly = Datestarstr2[0:4]                               row[2] = yearonly              rows.updateRow(row)      arcpy.Identity_analysis(Input_Polygons, Counties, outstewardshipcounties) #run spatial join tool arcpy.CalculateField_management(Input_Polygons, "OID", '!OBJECTID!', "PYTHON_9.3")  #create dictionary  path_dict = { } rows = arcpy.SearchCursor(outstewardshipcounties) for row in rows:          keyrow =  row.OID     valrow = row.FIPS_TXT     path_dict[keyrow] = valrow  urows = arcpy.UpdateCursor(Input_Polygons) for urow in urows:      upkey = urow.OID     if upkey in path_dict:         urow.setValue("County", path_dict[upkey])         urows.updateRow(urow) del row, rows, urow, urows