I have a Python script that joins a csv table to a geodatabase feature class. This works fine when I run the script in IDLE(2.7.13), but when I run this script from a toolbox in ArcGIS Pro, the field values are all null after the join. I made sure that the script is compatible with Python 3, and ran the Analyze Tools for Pro tool and found no issues.
Here is a code snippet:
arcpy.CopyRows_management(csvReport, "roomReport")
arcpy.JoinField_management(featureClass, "TextString", "roomReport", "RecordID", joinFields)
arcpy.Delete_management("roomReport")
arcpy.CalculateField_management(featureClass, "SiteFloor", "!Site! + ' ' + !Floor!", "PYTHON")
arcpy.CalculateField_management(featureClass, "UsableSF", "int(round(float(!UsableArea!)))", "PYTHON")
One thing that is very confusing is that the join field from the featureClass is called "Text" in the attribute table. This matches to the "RecordID" in the csv table. When I run the script standalone, "TextString" works (this script was written by someone else so I'm not sure about this discrepancy). When I run the script in the Pro toolbox, I get an error "field 'TextString' does not exist in the table" which is what I would expect to happen. I've tried adding a field called "TextString" to the featureClass, and calculating it's value as "Text" but this hasn't worked. If I change the match field to "Text" in the script, it also doesn't work.