I am using ArcGIS ArcMap 10.2 and I am trying to learn how to write a python script to use a value from an attribute table and perform some checks to it and assign an output value. At this moment all I want to do is multiple the input value from the attribute table by 2 and output it. This is as the below screenshot.

enter image description here

What the error message I get in the result is

Executing: CalculateField taranaki_dairy_farms stuff thickness PYTHON_9.3 "thickness = 
!River_ID! * 2"
Start Time: Sun Jun 07 20:34:23 2015
Failed to execute. Parameters are not valid.
ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)
Failed to execute (CalculateField).
Failed at Sun Jun 07 20:34:23 2015 (Elapsed Time: 0.00 seconds)

1 Answer 1


Code block:

def times2 (x):
    return x*2


times2 (!river_id!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.