I have two point layers. I trust the geometry (read: x and y coordinates) from one of them, but not the attributes data. I trust the attribute data but not the geometry from the other one (the attribute tables have different schema). The basic process (shown in a model builder screenshot below) is to spatially join the point layers, join the result to the points with good data/bad geometry and update their shape field with a script. The script produces one of those damnable "999999: Error executing function" errors.
If I manually step through every stop of the process and feed the update cursor a ready-made feature class it works fine, the points move as intended. It's just when it's set up to run in a model that the script throws the error. I have a feeling that I may be passing the parameter incorrectly, but I can't say for sure.
I've tried moving the "fc = GetParameterAsText()" line around (including in the update cursor parameters) to no avail.
I will also point that I shamelessly took the python from a post on Geonet, located here.
The Model: The Script:
import arcpy
from arcpy import env
env.workspace = r"C:\Temp\TempGDB.gdb"
#Get the feature layer from the previous step in the model
fc = arcpy.GetParameterAsText(0)
pnt = arcpy.Point()
#Update the shape field with the new coordinates
rows = arcpy.UpdateCursor(fc)
for row in rows:
pnt.X = row.X_Coord
pnt.Y = row.Y_Coord
row.shape = pnt
rows.updateRow(row)
del row, rows
The Script Tool Properties