AnsweredAssumed Answered

Calculate Field using Python

Question asked by Cep86 on Jun 16, 2015
Latest reply on Jun 16, 2015 by Cep86

I am trying to calculate a field based on derived values within a python script.  I keep getting the following error, though:


"Empty value for ObjectID = 3005

The calculated value is invalid for the row with ObjectID = 3005. For example, the calculated value may be too large for the field or you may be trying to add a string to a number field. This row will not be updated."


The script runs through every single feature and returns an error message identical to the one above for each feature.


# Calculate Region

# Set local variables
inTable = fiberFeatures
inField = "ProjectRegion"
expression = region

# Execute CalculateField
arcpy.CalculateField_management(inTable, inField, expression, "VB")


All variables check out just fine when I print them in the ArcMap Python window, and the field within my feature class is of text type.  The region is a simple two letter code such as "NC", "NE", "SW", etc...


I've tried with various combinations of alternatives, such as adding single/double quotes around region, I've added single/double/triple quotes around expression within the CalculateField function, and I've tried entering the variable straight into the function. 


The only help I can find through internet searches that pertains exactly to what I'm doing is HERE, but it is a little different and I'm not sure how to make it apply to my situation. 


I'm working on a Windows 7 machine and I'm running ArcGIS Standard version