<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Invalid field type with DeleteField_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/invalid-field-type-with-deletefield-management/m-p/680395#M52722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm running a script that places all of the fields that I want to delete from a feature class into a list(ListName), but when I run the DeleteField_management I receive the error - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute. Parameters are not vaild.&amp;nbsp; Invalid field type&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
import os

arcpy.env.workspace = "C:/Data_new/Temp/Default.gdb"

arcpy.env.overwriteOutput = True

parcel_clip2 = "C:/Data_new/Temp/Default.gdb/parcel_clip2"

fieldList = arcpy.ListFields(parcel_clip2)
ListName = []
fieldstokeep = ["Name1", "Address1", "City", "State", "ZipCode"]
for field in fieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ListName.append(field.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
index = 0
while index &amp;lt; len(ListName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ListName[index] in fieldstokeep:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListName.remove(ListName[index])
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = index + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

print(ListName)

arcpy.DeleteField_management (parcel_clip2,&amp;nbsp; ListName)

del ListName
del parcel_clip2
del fieldList
del fieldstokeep
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been at this awhile and I don;t understand what the issue is.&amp;nbsp; Any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2012 13:24:43 GMT</pubDate>
    <dc:creator>KP</dc:creator>
    <dc:date>2012-12-11T13:24:43Z</dc:date>
    <item>
      <title>Invalid field type with DeleteField_management</title>
      <link>https://community.esri.com/t5/python-questions/invalid-field-type-with-deletefield-management/m-p/680395#M52722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm running a script that places all of the fields that I want to delete from a feature class into a list(ListName), but when I run the DeleteField_management I receive the error - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute. Parameters are not vaild.&amp;nbsp; Invalid field type&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
import os

arcpy.env.workspace = "C:/Data_new/Temp/Default.gdb"

arcpy.env.overwriteOutput = True

parcel_clip2 = "C:/Data_new/Temp/Default.gdb/parcel_clip2"

fieldList = arcpy.ListFields(parcel_clip2)
ListName = []
fieldstokeep = ["Name1", "Address1", "City", "State", "ZipCode"]
for field in fieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ListName.append(field.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
index = 0
while index &amp;lt; len(ListName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ListName[index] in fieldstokeep:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListName.remove(ListName[index])
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = index + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

print(ListName)

arcpy.DeleteField_management (parcel_clip2,&amp;nbsp; ListName)

del ListName
del parcel_clip2
del fieldList
del fieldstokeep
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been at this awhile and I don;t understand what the issue is.&amp;nbsp; Any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 13:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/invalid-field-type-with-deletefield-management/m-p/680395#M52722</guid>
      <dc:creator>KP</dc:creator>
      <dc:date>2012-12-11T13:24:43Z</dc:date>
    </item>
  </channel>
</rss>

