Description
The calculation used by the Calculate Field, Calculate Fields (multiple), or Calculate Value tool is invalid.
This error can occur for Python syntax errors in an expression or code block. For example, when calling a function such as the round function, if the closing bracket is omitted, a syntax error occurs, and the following error will result:
ERROR 000539: File "<expression>", line 1
round(3, 2
SyntaxError: '(' was never closed
This error can also occur if an exception occurs when the Python code is run. For example, when adding a numeric value and a string, Python raises a TypeError exception, and the following error will result:
ERROR 000539: Traceback (most recent call last):
File "<expression>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
The tool uses exclamation marks (!) as field delimiters for the expression. If the delimiters are omitted (Classification versus !Classification!), the field name will be interpreted by Python as an undefined name, and the following error will result:
ERROR 000539: Traceback (most recent call last):
File "<expression>", line 1, in <module>
NameError: name 'Classification' is not defined
Similarly, if a field name in the expression includes delimiters, but the field name is spelled incorrectly, does not exist, or the field alias was used (when the alias does not match the field name), the tool will fail with the following error:
ERROR 000539: Invalid field Classification Value
Solution
For specific Python issues, consult the Python help for the version of Python you're using, or consult the Calculate Field, Calculate Fields (multiple), or Calculate Value help for more information on these tools.