First, I'm using Arc10, but calling
import arcgisscripting
gp = arcgisscripting.create(9.3)
because I am making a script for other users.
I get the following error when I try to use a codeblock/expression to calculate a field.
ERROR 000539: Error running expression: autoIncrement(gp.GetParameterAsText(2),gp.GetParameterAsText(3)) <type 'exceptions.NameError'>: name 'gp' is not defined
Failed to execute (CalculateField).
It seems that I can't pass in variables to my calc field code.
e.g.
gp.CalculateField_management(FCls30, IDPK, expression, "PYTHON", codeblock)
where
expression = "autoIncrement(gp.GetParameterAsText(2),gp.GetParameterAsText(3))"
If I pass in a string for each argument, then no problems.
Please help.
Thanks