<?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: Unable to delete feature class with arcpy.Delete_management() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144400#M63772</link>
    <description>&lt;P&gt;Thanks Dan, I will have a look at this.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 23:14:34 GMT</pubDate>
    <dc:creator>LuisDelValle</dc:creator>
    <dc:date>2022-02-15T23:14:34Z</dc:date>
    <item>
      <title>Unable to delete feature class with arcpy.Delete_management()</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1143955#M63754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a feature class called&amp;nbsp;DeviceView that I need to delete and recreate. The logic that I use to delete feature classes is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def delete(fc):
    if arcpy.Exists(fc):
        print(f"{fc} exists, deleting...", end="")
        try:
            arcpy.Delete_management(fc)
            print("successful")
        except Exception as e:
            print(f"unable to delete, reason: {e}")
    else:
        print(f"{fc} doesn't exist, skipping...")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;When I execute the logic above, I get the following log in the console:&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;DeviceView exists, deleting...successful&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Which indicates to me that the operation was 'successful' and no exception was generated while attempting to delete it.&lt;/P&gt;&lt;P&gt;However, the View still exists in the database after executing that logic and a subsequent scripts fails because of this.&lt;/P&gt;&lt;P&gt;I know the delete logic works for other feature classes (not views) which are effectively deleted from the DB.&lt;/P&gt;&lt;P&gt;Thanks in advance for any advise that could give an insight into this issue.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 08:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1143955#M63754</guid>
      <dc:creator>LuisDelValle</dc:creator>
      <dc:date>2022-02-15T08:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to delete feature class with arcpy.Delete_management()</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144000#M63757</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete.htm" target="_blank"&gt;Delete (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It works on objects on disk or those created in the memory workspace (not just in memory)&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/modelbuilder/the-in-memory-workspace.htm" target="_blank"&gt;Write geoprocessing output to memory—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;otherwise it has no effect&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 12:22:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144000#M63757</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-02-15T12:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to delete feature class with arcpy.Delete_management()</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144400#M63772</link>
      <description>&lt;P&gt;Thanks Dan, I will have a look at this.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 23:14:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144400#M63772</guid>
      <dc:creator>LuisDelValle</dc:creator>
      <dc:date>2022-02-15T23:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to delete feature class with arcpy.Delete_management()</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144473#M63775</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;. After a second look, the reason of this issue turned out to be a rather silly one. In ArcGIS Server Manager, we have these two map services: &lt;STRONG&gt;Device&lt;/STRONG&gt; and &lt;STRONG&gt;DeviceView&lt;/STRONG&gt;. The second one is pointing to the DB View I'm mentioning in the description of this post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hadn't stopped that service. Once I did that, the script deleted the view from the DB.&lt;/P&gt;&lt;P&gt;Apologies for the rookie mistake&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 03:17:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-delete-feature-class-with-arcpy-delete/m-p/1144473#M63775</guid>
      <dc:creator>LuisDelValle</dc:creator>
      <dc:date>2022-02-16T03:17:52Z</dc:date>
    </item>
  </channel>
</rss>

