AnsweredAssumed Answered

arcpy.da.UpdateCursor with editSession

Question asked by jamesfreddyc on Mar 29, 2017
Latest reply on Mar 29, 2017 by jamesfreddyc

Can anyone spot an issue with the codeblock?  I'm not exactly sure what occurred but this was working on Monday, I was out all-day Tuesday, and now Wednesday (today) the script fails to update, there are no errors and simply "hangs" and I must kill the PythonWin session.


The sde database that this Feature Class is in is for non-versioned editing.


ws = r'\\path_to_conn_file\my_conn_file.sde'
fcname = r'schema.FEATURE_CLASS_NAME'
input_fc = os.path.join(ws, fcname)
input_fc_sql = "APP_ID='" + inputAppId.strip().upper() + "'"
#check for a matching appId and set successmsg parameter for return JSON
test = [trow[0] for trow in arcpy.da.SearchCursor(input_fc, ['APP_ID'], input_fc_sql)]
if len(test) > 0:
##open edit session
edit = arcpy.da.Editor(ws)
edit.startEditing(False, False)

with arcpy.da.UpdateCursor(input_fc, ['REVIEW_STATUS', 'PERMIT_ID', 'PERMIT_TYPE', 'PERMIT_SUBTYPE', 'PROJECT_NAME'], input_fc_sql) as ucur:
     for urow in ucur:               
        urow[0] = inputStatus.strip().upper()
        urow[1] = inputPermitId.strip().upper()
        urow[2] = inputPermitType.strip().upper()
        urow[3] = inputPermitSubType.strip().upper()
        urow[4] = inputProjectName.strip().upper()

        ucur.updateRow(urow) #seems to hang here and does not go to print statement below
        print "step 1"

## Stop the edit operation.
## Stop the edit session and save the changes