<?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 Re: Problem with Delete Field in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515205#M17088</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well after 6 years I doubt he care... and just incase anyone forgets to use raw string formatting when using python, here is what happens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; table = "C:\GISDATA\resultTable"
&amp;gt;&amp;gt;&amp;gt; print(table)
esultTable&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No wonder the table couldn't be found&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:30:36 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-11T22:30:36Z</dc:date>
    <item>
      <title>Problem with Delete Field</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515202#M17085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attempting to delete fields from a result table of the ZoneStatisticsAsTable tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the script in python:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcgisscripting

gp = arcgisscripting.create(9.3)

table = "C:\GISDATA\resultTable"

fields = gp.ListFields(resultTable)

for field in fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((field.name != "BUILD_ID") and (field.name != "MAX")):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.deletefield(table, field)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: Object: Error in executing tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried running the deleteField tool on the same table in the command line in ArcMap and got an error saying the table does not exist or is not supported.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am able to manually delete fields on this table in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point I am going to find another way to accomplish my goal.&amp;nbsp; I am just curious as to why this isn't working.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 14:43:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515202#M17085</guid>
      <dc:creator>DanielDillard</dc:creator>
      <dc:date>2011-01-17T14:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Delete Field</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515203#M17086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;table = "C:\GISDATA\resultTable"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is incorrect, it must be &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;table = r"C:\GISDATA\resultTable"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;table = "C:\\GISDATA\\resultTable"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;table = "C:/GISDATA/resultTable"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and I suspect that a file extension is also needed&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 15:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515203#M17086</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-01-17T15:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Delete Field</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515204#M17087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will also then need to pass that to the list fields&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;fields = gp.ListFields(table)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;fields = gp.ListFields(resultTable) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;note: if that table is a shapefile attempting to delete a required field (e.g., FID) should also fail.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2016 19:03:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515204#M17087</guid>
      <dc:creator>ColinZwicker</dc:creator>
      <dc:date>2016-08-09T19:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Delete Field</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515205#M17088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well after 6 years I doubt he care... and just incase anyone forgets to use raw string formatting when using python, here is what happens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; table = "C:\GISDATA\resultTable"
&amp;gt;&amp;gt;&amp;gt; print(table)
esultTable&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No wonder the table couldn't be found&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-with-delete-field/m-p/515205#M17088</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T22:30:36Z</dc:date>
    </item>
  </channel>
</rss>

