AnsweredAssumed Answered

Insert Cursor is failing after retriving value using search curor.

Question asked by jlavis54 on Dec 13, 2013
Latest reply on Dec 16, 2013 by Wayne_Whitley
Hey GISers My code is failing to insert cursor value.  The value it is return for parcel is correct its just not inserting it into my table.  

A little help would be gratly appreciated.  Thank you.


# Insert Cursor for GDB table to GDB table 
# Import modules, environment settings
import arcpy, traceback, string
arcpy.env.overwriteOutput = True

# Database connection variables on SPGISPROC1
OutFGDB = r"P:\batch\APO\District_overlay.gdb\pa_fp_dat1"
InFGDB = r"P:\batch\APO\District_overlay.gdb\pa_fp_rel1"

#Create cursor for input table items
InCursor = arcpy.SearchCursor(InFGDB)

# Create a variable that stores the value for column in a given row of the input table

for InRow in InCursor:

    parcel      = InRow.getValue('pafp_frq_PARCEL') 
    fp_zone1    = InRow.getValue('pafp_frq_ZONE2')

    # Copy the stored value from the input table into the output table
    gdbCursor = arcpy.InsertCursor(OutFGDB)
    row = gdbCursor.newRow()

    if fp_zone1:
        fp_zone1 = fp_zone1.upper
    #Fill out fields with variables from input table       
    row.pafp_frq_PARCEL = parcel
    row.pafp_frq_ZONE2  = fp_zone1   

    #Insert new row into output file

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

ERROR Message

Traceback (most recent call last):
  File "C:\Python27\ArcGISx6410.1\Lib\site-packages\pythonwin\pywin\framework\", line 325, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\gisdata\Python\", line 28, in <module>
    row.pafp_frq_PARCEL = parcel
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 35, in __setattr__
    return setattr(self._arc_object, attr, ao)
RuntimeError: ERROR 999999: Error executing function.