I've previously successfully run a Python script in ArcGIS Pro 2.6.x that included the use of the analysis geoprocessing tool, Generate Near Table. Recently upgraded to ArcGIS Pro 2.9.2 and attempted to run the same script and I get this error: ERROR 000728: Field NEAR_FID does not exist within table.
According to esri documentation the output table should have this field.
Anyone else experiencing the same thing?
Solved! Go to Solution.
@KathleenMohla1 I work with Dan on the geoprocessing team, and we have been looking at your case.
While we are investigating I want to point out that your code can be updated on line 91 from this:
arcpy.AddJoin_management(tbl_Near,"NEAR_FID", r"in_memory\xPriRtes", "OBJECTID")
arcpy.AddJoin_management(tbl_Near,"xNear.NEAR_FID", r"in_memory\xPriRtes", "OBJECTID")
and the script tool can complete successfully. (the difference is the xNear.NEAR_FID part in the second parameter). When you perform a join, the field names become qualified with the table name. It is best practice when using joined layers as input to include the table name qualification with the field name so that the processing tool knows the exact field to use. With what you have reported we are finding that there is some inconsistent behaviors when you exclude the table name qualification. I think this topic should be familiar to you already, as the script already includes usage of table name qualification when using join layers as input (for example, the SelectLayerByAttribute and CalculateField tools on lines 92-93).
We will keep investigating to fix the issue so that the code can work as-is from 2.6 to a future release, but please take the table name qualification as a way to get up and running again.
Since the Python script worked using ArcGIS Pro 2.6.x and does not work in ArcGIS Pro 2.9.2, it has me wondering if something in Python changed between the two releases. You could run the Analyze Tools for Pro to determine if the Python script functionality is correct. What is the result?
Ran the Analyze Tools for Pro and No Problems reported.
Thx for the update Kathleen - I saw a response that describes this error message and mentioned something about an in_memory issue in a script. You can read about it here.
Thank you Robert. I'll check it out.
Does the tool work from tool dialog? Could you share a repro sample of the script and data? I can pass it to my team (Geoprocessing).
The script is within a toolbox and when run displays like other geoprocessing tools within the application interface - I think that is what you are asking.
I've attached a geodatabase with the input feature class (AR_clip) and the script (Check Secondaries Match Primaries) within the ValidateTools toolbox.
Thank you for the assistance. Hope your team can shed some light on what the hang up is.
I got the gdb, but not the ValidateTools toolbox with the script tool and source code. Could you share those?
The toolbox should be in the gdb and the script within the toolbox.
Let me know if it's not there and I'll try and send it again.
I see the toolbox and the script tool, but when I tried to run with your input AR_clip, it says no associated script:
Could you share the py file? I can connect it to the tool by myself.