AnsweredAssumed Answered

Script crashes

Question asked by BLomas on Mar 24, 2016
Latest reply on Mar 25, 2016 by wwmiller68

When I run the following script it just spins and spins then arcmap turns to "not responding". I'm trying to update a versioned parcel layer using a .mdb file. When I "quote" out the updatecursor everything seems to run fine and it seems to enter the edit session as well. Any ideas on what it could be? I'm stuck.



from time import strftime 
print "Start script: " + strftime("%Y-%m-%d %H:%M:%S") 
import arcpy
from arcpy import env  
sourceFC = r'M:\ParcelDatabase\...\Feb_2016_Ownership'
# Use list comprehension to build a dictionary from a da SearchCursor  
valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(sourceFC, sourceFieldsList)}  

arcpy.env.workspace = r"Database Connections\parcelpubdelete.sde" 

updateFC = r"Database Connections\...\ArcGISSDE.SDE.TaxParcel"


edit = arcpy.da.Editor(r"Database Connections\parcelpubdelete.sde")
edit.startEditing(False, True)
print "entered edit session"

with arcpy.da.UpdateCursor(updateFC, updateFieldsList) as updateRows:  
     for updateRow in updateRows:  
         # store the Join value of the row being updated in a keyValue variable  
         keyValue = updateRow[0]  
         # verify that the keyValue is in the Dictionary  
         if keyValue in valueDict:  
             # transfer the values stored under the keyValue from the dictionary to the updated fields.  
             for n in range (1,len(sourceFieldsList)):  
                 updateRow[n] = valueDict[keyValue][n-1]  
del valueDict

print "Finished script: " + strftime("%Y-%m-%d %H:%M:%S")