Select to view content in your preferred language

using python scripts in models

3675
11
10-18-2011 03:51 AM
YousafHassan
Emerging Contributor
Hi I am trying to use python script in a model but it is throwing an error message:

ERROR 000539: Runtime error <type 'exceptions.NameError'>: name 'table2' is not defined
Failed to execute (Calculate Field).

I guess, it is about how to use table2 in the CalculateField_management function. I am not sure how I can do it.

I have attached the screen shot of my model and the script. Any help would be really appreciated.

Thanks
Tags (2)
0 Kudos
11 Replies
YousafHassan
Emerging Contributor
Hi
I am using 10 with an ArcView licence, so don't have access to Feature To Point tool.

Which version, 9.2, 9.3 and 10.x all have different syntax to access the shape field properties.

I recommend you instead of accessing the centroid this way, take an easier path: use the out of the box Feature To Point tool followed by the Add XY Coordinates tool.
0 Kudos
YousafHassan
Emerging Contributor
I changed the expression type to PYTHON_9.3 and it's working now.
0 Kudos