AnsweredAssumed Answered

Issues with update cursor in Python

Question asked by Twee3201 on Feb 2, 2015
Latest reply on Feb 2, 2015 by Twee3201

Hi all, I am new to Python and I am currently working on a project where I am attempting to use the update cursor to use a numeric value in a field, and populate a secondary field with text values based off of those numeric values. This code will run successfully, but it will not update the field as desired. My e.message is giving me an __exit__  message. Here is my code:

 

# Import system modules

import arcpy

from arcpy import env

 

 

# Set environment settings

env.workspace = "F:\Geog390\Lab 3\Lab3.gdb"

env.overwriteOutput = True

fc = 'TPSJ'

fields = ('Join_Count', 'Validate')

#'TPSJ' is my feature class, 'Join_Count' is my first field, and 'Validate' is the field I am trying to populate

try:

    with arcpy.UpdateCursor(fc,fields) as cursor:

          for row in cursor:

               if row.getValue[JOIN_COUNT] == 1:

                   row.setValue[VALIDATE] = "Validated"

               else:

                   row.setValue[VALIDATE] = "Not Validated"

    cursor.updateRow(row)

except Exception, e:

    print e.message

 

any help would be greatly appreciated, thanks!

Outcomes