AnsweredAssumed Answered

Pythonerror ERROR 000622

Question asked by DEVAPPGIS on Mar 23, 2017
Latest reply on Mar 29, 2017 by DEVAPPGIS

Hi,

i have develop a python script that convert a MakeFeatureLayer to Shapefile into a specific folder with concatenation timestamp. This is the code write:

filename = r"C:\tmp"

data = datetime.datetime.now()
timestamp = str(data).replace("-","").replace(":","").replace(".","").replace(" ","_")

 

events_l = arcpy.MakeFeatureLayer_management("event_lyr", "events_layer")
print "Inizio segmentazione dinamica eventi"
updateFC = arcpy.CopyFeatures_management(events_l,filename + "\\events_"+timestamp+".shp")
arcpy.SelectLayerByAttribute_management("event_lyr", "NEW_SELECTION", "LOC LIKE 'LO%'")
arcpy.AddMessage("num_sel: " + str(arcpy.GetCount_management("event_lyr")))
print("num_sel: " + str(arcpy.GetCount_management("event_lyr")))

layer = arcpy.MakeFeatureLayer_management(Lo_UTM, "loc_lyr")
sourceFC = layer
sourceField = ['OR_ID','SHAPE@']
valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(sourceFC, sourceField)}

 

updateFieldsList = ["loc", "Shape"]
    with arcpy.da.UpdateCursor(updateFC, updateFieldsList) as updateRows:
        for updateRow in updateRows:
            keyValue = updateRow[0]
            print(keyValue)
            if keyValue in valueDict:
                updateRow[1] = valueDict[keyValue][0]
                print(valueDict[keyValue][0])
                updateRows.updateRow(updateRow)
    arcpy.SelectLayerByAttribute_management('event_lyr', "CLEAR_SELECTION")
    

  arcpy.SetParameter(1, arcpy.MakeFeatureLayer_management(filename + "\\events_"+timestamp+".shp","output_lyr",""))

 

when i run the script on ArcMap works very fine and so i have publish it on ArcGIS Server as a GP Service Async.

When i run this GP by REST Folder works very fine, but if i stop the GP Service and clear the folder with shapefile created after start if i run the GP this failed and on log of ArcGIS Server i have this error:

 

in MakeFeatureLayer raise e ExecuteError: ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter out_layer. Failed to execute

 

on the ultimate line of script.

But i f i republish the script the GP works.

Any help why this issues?

Thanks

Outcomes