I am new to ArcGIS and the ArcPY Module; recently I've run into an issue with ArcPY losing resolution to an object (a feature class) that I know exists. Error: name '<variable name>' is not defined (where <variable name> is the object/feature class to which I'm referring).
The '<variable name>' can be accessed prior to the CalculateField execution in other ArcPY tools.
Also, the expression that I'm using in CalculateField was built and tested in both CalculateField ArcGIS Pro geoprocessing pane and in the python window in pro.
The feature class is created and then joined to a local feature class based on a couple conditions -- that join is successful; however, when attempting to create an expression of which part of the expression refers to the feature class, I get the error (name '<variable name>' is not defined) in the CalculateField tool
An alternate solution was to use UpdateCursor, but it states that it cannot update a joined table.
Any ideas?
Solved! Go to Solution.
Cody
Shortly after posting this issue I tried a new route and it worked. As stated, I'm new to ArcPy so I did not realize there is an arcpy.CalculateField class and an arcpy.CalculateFields (plural) class. Using arcpy.CalculateFields solved the issue
Hey @MarkMcDill
Would it be possible to share a snippet of the code referenced along with a screenshot of the error maybe? We'd be able to get a nice look into how the program is interacting.
Cody
Cody
Shortly after posting this issue I tried a new route and it worked. As stated, I'm new to ArcPy so I did not realize there is an arcpy.CalculateField class and an arcpy.CalculateFields (plural) class. Using arcpy.CalculateFields solved the issue