import arcpy arcpy.AddField_management(r"C:\data\airport.gdb\schools", "ref_ID", "LONG", 9, "", "", "refcode", "NULLABLE", "REQUIRED")
This is the code I am using:
arcpy.env.workspace = "C:\\Database\\Redlands.gdb"
inputFC = "Hospitals"
field = "Full_Address"
lstFlds = arcpy.ListFields (inputFC, field)
if len(lstFlds) ==0:
arcpy.AddField_management(inputFC, field, "Text")
.............
I appreciate your help
import arcpy arcpy.env.workspace = r"C:\Database\Redlands.gdb\" dir = r"C:\Database\Redlands.gdb\" inputFC = "Hospitals" field = "Full_Address" FC = dir + inputFC lstFlds = arcpy.ListFields(FC, field) if len(lstFlds) == 0: arcpy.AddField_management(FC, field, "Text") print "len = zero. Field added." else: print "len does not = zero. field not added.""
I had a 000732 data not supported or does not exist error. Turns out I had multiple instances of the Python IDLE GUI open and running when trying to run the script. This must create locks on the dataset. So closing the other python consoles down solved this issue for me.
ESRI need to update this error as it's currently misleading. The dataset IS supported (it was an excel spreadsheet) and the data DOES exist (trust me, it did!)