hajasw

CalculateField_management generates ERROR 000539

Discussion created by hajasw on Nov 17, 2011
Latest reply on Dec 23, 2011 by hajasw
I am using ARCGIS 10.0.  I am trying to populate a field through CalculateField.

The approach I am trying now, is to build a stack-class to contain the values.  Then I can use a method from the stack-class as the function that goes into CalculateField.  My command looks like this:

[INDENT][/INDENT]gp.CalculateField_management(tmpcopy, 'temp', 'AsStack.GetVal())', 'PYTHON')

The resulting error message is:
[INDENT][/INDENT]ExecuteError: ERROR 000539: Error running expression: AsStack.GetVal()) <type 'exceptions.SyntaxError'>: unexpected EOF while parsing (<string>, line 1)
Failed to execute (CalculateField).

I have confirmed that AsStack.GetVal() gives the correct number of real-values between zero and one. 

I have found a couple of similar commands that do work:
[INDENT]gp.CalculateField_management(tmpcopy, "temp", 'numpy.random.rand()', "PYTHON")
[/INDENT]gp.CalculateField_management(tmpcopy, "temp", 'AsStack.nval', "PYTHON") (nval is just an integer value)

I am running out of things to try.  The calculations I am using do require an external library (rpy2).  I might be able to avoid the stack-class - but eventually I do think I will need to give CalculateField_managemen a method from a class as the python-expression.

Does anybody have a suggestion for what I should try next?

Thanks,
Wayne Hajas

Outcomes