<?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: Delete management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477862#M37408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got an idea.... use the delete management tool... manually... the go to the Results window, copy the syntax and you will have the required syntax for the script.&amp;nbsp; You will continue to spin your wheels until you get a real copy of what actually works.&amp;nbsp; If you can't delete it manually, then you will have an error message...that would be just as good, then you would know why you cant delete them.&amp;nbsp; So the rule...do it manually once, using the tools, learn/get the syntax from Results and incorporate what it says works, not what we frail humans think should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jan 2016 16:19:18 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-01-20T16:19:18Z</dc:date>
    <item>
      <title>Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477861#M37407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I have a loop in which if the statement is TRUE I want to delete the last element and add the new. I am posting a part of the code because as many times I tried it, still it doesn't delete the shp and the rasters. Any help is much appreciated. Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;elif arithmos &amp;gt;= valueslist[num_pnts2 - 1]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OM = n - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #VIEWSHED = "view" + str(OM)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #POINT = "point" + str(OM) + ".shp"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management("point" + str(OM) + ".shp", "")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management("view" + str(OM), "")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a few words at this part of the code, the last element will be for n=4 ,view4 and I want to delete the (OM = 4-1&amp;nbsp; =&amp;gt;&amp;nbsp; OM = 3)&amp;nbsp; view3.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:06:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477861#M37407</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2021-12-11T21:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477862#M37408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got an idea.... use the delete management tool... manually... the go to the Results window, copy the syntax and you will have the required syntax for the script.&amp;nbsp; You will continue to spin your wheels until you get a real copy of what actually works.&amp;nbsp; If you can't delete it manually, then you will have an error message...that would be just as good, then you would know why you cant delete them.&amp;nbsp; So the rule...do it manually once, using the tools, learn/get the syntax from Results and incorporate what it says works, not what we frail humans think should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477862#M37408</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T16:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477863#M37409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest adding a print statement to make sure you are getting to the elif, and print what you are trying to delete. Let the variable populate to the filename, and then&lt;/P&gt;&lt;P&gt;print(VIEW SHED&lt;/P&gt;&lt;P&gt;print(POINT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can also include&lt;/P&gt;&lt;P&gt;arcpy.Exists option to make sure it find the file before you try to delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry, restricted on formatting my response right now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:19:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477863#M37409</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-01-20T16:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477864#M37410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mr. Patterson this is what I get if I do it manually&lt;/P&gt;&lt;P&gt;&amp;lt;Result 'true'&amp;gt;. I have no idea what that means but it doesn't delete anything. I tried also to pass the name to a variable and put the variable at Delete_management but with no result also. What can be reason for that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 20:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477864#M37410</guid>
      <dc:creator>KONPETROV</dc:creator>
      <dc:date>2016-01-20T20:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477865#M37411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;copy the section of the result window...it reveals more than that by many lines&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 21:17:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477865#M37411</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T21:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477866#M37412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see this&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/executing-tools/using-the-results-window.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/executing-tools/using-the-results-window.htm"&gt;Using the Results window—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;you can expand the sections and do a screen grab and/or copy to get the full results of the process &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 21:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477866#M37412</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-20T21:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete management</title>
      <link>https://community.esri.com/t5/python-questions/delete-management/m-p/477867#M37413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.env.workspace = r'&amp;lt;some path/directory&amp;gt;'
elif arithmos &amp;gt;= valueslist[num_pnts2 - 1]:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OM = n - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureclasses = arcpy.ListFeatureClasses("point" + str(OM) + ".shp")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rasters = arcpy.ListRasters("view" + str(OM))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in featureclasses:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(f)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for r in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(r)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/delete-management/m-p/477867#M37413</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T21:06:51Z</dc:date>
    </item>
  </channel>
</rss>

