<?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: How to use Arcpy.Delete_management to delete rasters? in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763920#M68</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you saying the problem is its failing on the second iteration? What's the full error? Can you print the tin filepath if that's what's erroring?&lt;/P&gt;&lt;P&gt;Why do you need the time.sleep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Feb 2020 18:31:15 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-02-21T18:31:15Z</dc:date>
    <item>
      <title>How to use Arcpy.Delete_management to delete rasters?</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763919#M67</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I have this piece of code that loops through a set of tins and creates contours. The piece of code will create a contour from the first tin, but on the next tin in the folder it says that the tin is unsupported. My last line of code calls it to delete a raster which I had working in memory "memory/tempraster", but now I've noticed when I don't put it in memory, It doesn't delete the raster. Can anyone help? Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;tin_list = arcpy.ListDatasets("*", "Tin")
if contour_options == self.contourBase[0]:
    for tin in tin_list:
        outcontname =tin+"_cont"
        outcontnamelyr = os.path.basename(os.path.normpath(tin))+"_cont_lyr"
        arcpy.AddMessage("TIN to raster")
        arcpy.TinRaster_3d(tin, "raster","FLOAT", "NATURAL_NEIGHBORS","CELLSIZE %s"%(raster_options))
        arcpy.AddMessage("Contours")
        contResult = arcpy.Contour_3d( "raster",outcontname,1.0,0.0)
        while contResult.status &amp;lt; 4:
            time.sleep(0.2)
        arcpy.Delete_management("raster", '')&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763919#M67</guid>
      <dc:creator>RuthCostley1</dc:creator>
      <dc:date>2021-12-12T08:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcpy.Delete_management to delete rasters?</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763920#M68</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you saying the problem is its failing on the second iteration? What's the full error? Can you print the tin filepath if that's what's erroring?&lt;/P&gt;&lt;P&gt;Why do you need the time.sleep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2020 18:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763920#M68</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-02-21T18:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arcpy.Delete_management to delete rasters?</title>
      <link>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763921#M69</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The script created 1 contour from Yck_pt1, and I have received the message "tin to raster". The tin filepath is currently at&amp;nbsp;C:\Bathymetrycontours\Yck. The exact error is below. I have confirmed that Yck_pt2 is a tin, and I can run the exact tool in ArcPro with the dataset, and it does indeed work and exist. I removed the time.sleep, but I still get the error. Thanks for your help!&lt;/P&gt;&lt;P&gt;ERROR 000732: Input TIN: Dataset Yck_pt2 does not exist or is not supported&lt;BR /&gt;Failed to execute (TinRaster).&lt;BR /&gt;Failed to execute. Parameters are not valid.&lt;BR /&gt; ERROR 000732: Input TIN: Dataset Yck_pt2 does not exist or is not supported&lt;BR /&gt;Failed to execute (TinRaster).&lt;BR /&gt; Failed to execute (BathymetryContours)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2020 18:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/how-to-use-arcpy-delete-management-to-delete/m-p/763921#M69</guid>
      <dc:creator>RuthCostley1</dc:creator>
      <dc:date>2020-02-21T18:50:33Z</dc:date>
    </item>
  </channel>
</rss>

