I went through the documentation, and searched around but wasn't able to figure this out. What I want to do is export shapefiles, but have certain fields turn off. I was successful in turning off regular fields with delete.field.management, but I was unable to delete the
FID field, so now I am looking into turning the field off, instead of deleting it. Below is a part of the sample code I am working on before I fill in with my data -
fields= arcpy.ListFields(out_layer_file) # Create a fieldinfo object fieldinfo = arcpy.FieldInfo() # Iterate through the fields and set them to fieldinfo for field in fields: if field.name == "FID": fieldinfo.setVisible(field.name, "HIDDEN") arcpy.MakeFeatureLayer_management(out_layer_file, "New2", field_info) arcpy.SaveToLayerFile_management("New2", out_layer_file1, "ABSOLUTE")
Most of this was taken from ESRI, there isn't a lot of info on fieldinfo. I am new to python in general and trying to figure this out my error is this:
type 'exceptions.AttributeError': FieldInfo: Error in parsing arguments for SetVisible
Its not the FID field because even if I change it to a regular field I still get the error.
Any ideas - or any other documents on how to go about this?