ERROR 999999 when running python as service

628
5
11-22-2013 12:39 AM
irishadar
New Contributor III
hi all,

the code below runs ok from ArcCatalog,

but once i publish it it fail with error  :

Traceback (most recent call last): 
File "D:\arcgisserver\directories\arcgissystem\arcgisinput\UploadeS.GPServer\extracted\v101\my_toolboxes\UPLOADER.py", line 55,
in  arcpy.CalculateField_management(lyrSource, g_ESRI_variable_3, SURVEY_ID, "PYTHON", "") 
File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 3129,
 in CalculateField raise e ExecuteError: ERROR 999999: Error executing function.
 General function failure Failed to execute (CalculateField).
 Failed to execute (UploadeShapeFiles). Failed to execute (UploadeShapeFiles)."


it is allso works if i use only "appand"

any one notice what is worng?!!!

# Import arcpy module
import arcpy

arcpy.env.overwriteOutput=True
arcpy.env.workspace="d:\\GIS_PROC\\TEMP.gdb"

# Load required toolboxes
#arcpy.ImportToolbox("Model Functions")

#getting user parms
#LyrNamesStr=arcpy.GetParameterAsText(0)
#SURVEY_ID=arcpy.GetParameterAsText(1)

# hard coded parms for testing
LyrNamesStr="area_528d0df4ec13b"
SURVEY_ID=99

LyrNames =LyrNamesStr.split(',')
print LyrNames

startUrl ='D:\\AllData\\';
EndUrl='.shp'
destenationUrlStart="C:\\Users\\administrator.IAA\\AppData\\Roaming\\ESRI\\Desktop10.1\\ArcCatalog\\archeo@msurvey.sde\\"


#UPL_LINE UPL_POLY UPL_POINT
# Local variables:
for lyr in LyrNames:
    lyrSource=startUrl+lyr+EndUrl
    
    print '1'
    desc=arcpy.Describe(lyrSource)
    #print "Feature Type:  " + desc.shapeType

    if desc.shapeType == "Polygon":
        destLyr=destenationUrlStart+"\\MSURVEY.UPL_POLY"
        print 'polygon'
        FieldAllocation="SNUMBER \"SNUMBER\" true true false 2 Short 0 4 ,First,#,"+lyrSource+",Snumber,-1,-1;ELEMENTS \"ELEMENTS\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",elements,-1,-1;REMARKS \"REMARKS\" true true false 100 Text 0 0 ,First,#,"+lyrSource+",remarks,-1,-1;SSIZE \"SSIZE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Ssize,-1,-1;RECOMENDAT \"RECOMENDAT\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",recomendat,-1,-1;GVUL_ATAR \"GVUL_ATAR\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",gvul_atar,-1,-1;PERIOD \"PERIOD\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",period,-1,-1;GPS_DATE \"GPS_DATE\" true true false 36 Date 0 0 ,First,#,"+lyrSource+",Gps_Date,-1,-1;DATAFILE \"DATAFILE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Datafile,-1,-1;METHOD_TYP \"METHOD_TYP\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",METHOD_TYP,-1,-1;CRE_METHOD \"CRE_METHOD\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",CRE_METHOD,-1,-1;SURV_ID \"SURV_ID\" true true false 4 Long 0 7 ,First,#,"+lyrSource+",SURV_ID,-1,-1;SHAPE.AREA \"SHAPE.AREA\" false false true 0 Double 0 0 ,First,#;SHAPE.LEN \"SHAPE.LEN\" false false true 0 Double 0 0 ,First,#"
        #arcpy.RepairGeometry_management(lyrSource, "DELETE_NULL")
        arcpy.CalculateField_management(lyrSource, "SURV_ID", SURVEY_ID, "PYTHON", "")
        arcpy.Append_management(RepairedArea, destLyr,"NO_TEST",FieldAllocation, "")


    elif desc.shapeType=="Point":
        destLyr=destenationUrlStart+"MSURVEY.UPL_POINT"
        print 'Point'
        FieldAllocation="SNUMBER \"SNUMBER\" true true false 2 Short 0 4 ,First,#,"+lyrSource+",Snumber,-1,-1;ELEMENTS \"ELEMENTS\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",elements,-1,-1;REMARKS \"REMARKS\" true true false 100 Text 0 0 ,First,#,"+lyrSource+",remarks,-1,-1;SSIZE \"SSIZE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Ssize,-1,-1;RECOMENDAT \"RECOMENDAT\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",recomendat,-1,-1;GVUL_ATAR \"GVUL_ATAR\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",gvul_atar,-1,-1;PERIOD \"PERIOD\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",period,-1,-1;GPS_DATE \"GPS_DATE\" true true false 36 Date 0 0 ,First,#,"+lyrSource+",Gps_Date,-1,-1;DATAFILE \"DATAFILE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Datafile,-1,-1;METHOD_TYP \"METHOD_TYP\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",METHOD_TYP,-1,-1;CRE_METHOD \"CRE_METHOD\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",CRE_METHOD,-1,-1;SURV_ID \"SURV_ID\" true true false 4 Long 0 7 ,First,#,"+lyrSource+",SURV_ID,-1,-1"
        arcpy.CalculateField_management(lyrSource, "SURV_ID", SURVEY_ID, "PYTHON", "")
        arcpy.Append_management(lyrSource, destLyr, "NO_TEST",FieldAllocation, "")

    elif desc.shapeType=="Polyline":
        print 'Polyline'
        destLyr=destenationUrlStart+"MSURVEY.UPL_LINE"
        FieldAllocation="SNUMBER \"SNUMBER\" true true false 2 Short 0 4 ,First,#,"+lyrSource+",Snumber,-1,-1;ELEMENTS \"ELEMENTS\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",elements,-1,-1;REMARKS \"REMARKS\" true true false 100 Text 0 0 ,First,#,"+lyrSource+",remarks,-1,-1;SSIZE \"SSIZE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Ssize,-1,-1;RECOMENDAT \"RECOMENDAT\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",recomendat,-1,-1;GVUL_ATAR \"GVUL_ATAR\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",gvul_atar,-1,-1;PERIOD \"PERIOD\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",period,-1,-1;GPS_DATE \"GPS_DATE\" true true false 36 Date 0 0 ,First,#,"+lyrSource+",Gps_Date,-1,-1;DATAFILE \"DATAFILE\" true true false 50 Text 0 0 ,First,#,"+lyrSource+",Datafile,-1,-1;METHOD_TYP \"METHOD_TYP\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",METHOD_TYP,-1,-1;CRE_METHOD \"CRE_METHOD\" true true false 4 Long 0 8 ,First,#,"+lyrSource+",CRE_METHOD,-1,-1;SURV_ID \"SURV_ID\" true true false 4 Long 0 7 ,First,#,"+lyrSource+",SURV_ID,-1,-1;SHAPE.LEN \"SHAPE.LEN\" false false true 0 Double 0 0 ,First,#"
        arcpy.CalculateField_management(lyrSource, "SURV_ID", SURVEY_ID, "PYTHON", "")
        arcpy.Append_management(lyrSource, destLyr, "NO_TEST",FieldAllocation, "")




print 'finish'
Tags (2)
0 Kudos
5 Replies
irishadar
New Contributor III
hi again ,I've managed to focus on the problem , this is the new script it fails with general error 999999:

import arcpy

# Script arguments
Expression = arcpy.GetParameterAsText(0)

# Local variables:
area_shp = r"D:\support\iris\area.shp"


# Process: Calculate Field
arcpy.CalculateField_management(area_shp, "SURV_ID", Expression, "PYTHON", "")


has this happened to anyone ?

iris
0 Kudos
MathewCoyle
Frequent Contributor
What is your expression? And why not use an update cursor?
0 Kudos
irishadar
New Contributor III
hi , my expression is long.
and i have already tried to replace with cursor update but it fails in with the same error .

startUrl ="D:\\AllData\\area.shp"

#arcpy.CalculateField_management(RepairedArea, "SURV_ID", "666", "PYTHON")

rows = arcpy.UpdateCursor(startUrl)
# Update the field used in buffer so the distance is based on the
# road type. Road type is either 1, 2, 3 or 4. Distance is in meters.
for row in rows:
    row.setValue("SURV_ID", 7878)
    rows.updateRow(row)

# Delete cursor and row objects to remove locks on the data
del row
del rows

print 'finish'
0 Kudos
MathewCoyle
Frequent Contributor
Check to make sure the field has that exact name and it is the right type.
0 Kudos
irishadar
New Contributor III
yes i have  it is a match ,
the scrip tool is working well under arcmap or arccatalog it is only fails when i publish it as a services .
this is the exact error
:


Error executing tool.: Traceback (most recent call last):
File "D:\arcgisserver\directories\arcgissystem\arcgisinput\fieldcalc1.GPServer\extracted\v101\my_toolboxes\calc1.py", line 22,in  arcpy.CalculateField_management(area_shp, g_ESRI_variable_2, g_ESRI_variable_3, "PYTHON", "")
File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 3129, in CalculateField raise e ExecuteError: ERROR 999999: Error executing function. General function failure Failed to execute (CalculateField). Failed to execute (fieldcalc1). Failed to execute (fieldcalc1).
0 Kudos