shaun_weston-eagle-co-nz-esridist

Python Error With UpdateCursor

Discussion created by shaun_weston-eagle-co-nz-esridist on Mar 16, 2012
Latest reply on Jun 8, 2012 by jeffreinhart
I keep getting this error message when I try run a script to update some fields:

RuntimeError: ERROR 999999: Error executing function.
Workspace or data source is read only.
Workspace or data source is read only. [The C:\Data\Current Projects\Goldpine\Scratch.gdb workspace is read only.]

This seems to only come up when I run it on larger datasets?

This is my code:

import arcpy


# Overwrite existing data
arcpy.env.overwriteOutput = True


import arcpy


# "C:\\Data\\Current Projects\\Goldpine\\Scratch.gdb\\ParcelsWithAddressPropertiesSELECTION"
# arcpy.GetParameterAsText(0)
myFile = "C:\\Data\\Current Projects\\Goldpine\\Scratch.gdb\\ParcelsWithAddressProperties"
sortField = "PAR_ID"
appendField = "Full_Address"
multiField = "MultipleAddresses"
parcelID = "PAR_ID"


rows = arcpy.UpdateCursor(myFile,"","","",sortField + " A")


for row in rows:
   if (row.FREQUENCY == 1):  
      appendValue = row.getValue(appendField)
      row.setValue(multiField, appendValue)
      rows.updateRow(row)
   if (row.FREQUENCY > 1):
      x = 0
      addressList = ""
      while (x < row.FREQUENCY):
        if  (x == 0):
          previousParcel = row.getValue(parcelID)       
          appendValue = row.getValue(appendField)       
          addressList = appendValue
          row.setValue("MultipleAddresses", addressList)
          rows.updateRow(row)
          x += 1            
        else:   
          currentParcel = row.getValue(parcelID)    
          if (currentParcel == previousParcel):
             appendValue = row.getValue(appendField)
             if (len(addressList) > 200):
                addressList = addressList
             else:   
                addressList = addressList + " || " + appendValue
             row.setValue("MultipleAddresses", addressList)
             rows.updateRow(row)
             x += 1
      

Outcomes