Good morning,
I am about to pull my hair out because in my newest script, I am attempting to use CalculateField to add text to a text field, and am getting some maddeningly inconsistent results. The field length is 3, and I am attempting to simply calculate Yes or No into it, but it comes back with nulls every time I run it, with no error messages from the script. However, the script also calculates a second text field with a length of 5 that is meant for zip codes (it is text in order to accommodate Canadian FSAs), and this calculation is successful for American-style five digit numeric zip codes.
So I tried using the Python interface in ArcMap to manually calculate the field in the layer, and my results are shown below.
Integer, or integer within single quotes:
Successful calculation.
String with all letters ('Yes', 'No', 'ABC'), or alphanumeric string beginning with a letter ('A30'):
Empty value for ObjectID = 1
The calculated value is invalid for the row with ObjectID = 1. 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.
Do you want to process the rest of the rows? If the problem re-occurs while processing, this message will not be displayed. No messages will be generated if you click Yes. Click No to abort.
Alphanumeric string beginning with a number ('30A'):
General error executing calculator.
ERROR 999999: Error executing function.
Expected end of statement
Failed to execute (CalculateField).
Again, these are string fields that should be able to accept any alphanumeric value I want to calculate into them. I should also mention that if I edit the layer directly in ArcMap, I can successfully calculate text into the field that way, but I need the script to be able to do this as it is part of a cursor that repeats numerous times. Has anyone else out there run into this problem?
Thank you in advance for your assistance.