<?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: Erase tool in python fails when using a feature layer variable for an input in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300335#M67986</link>
    <description>&lt;P&gt;I changed the feature class to reference a different connection file (the first was a db user with read access to the database, the new connection uses Windows authentication and the user has read/write access) and that allowed things to work. I am not sure why one worked and another failed.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 18:09:56 GMT</pubDate>
    <dc:creator>TonyContreras_Frisco_TX</dc:creator>
    <dc:date>2023-06-16T18:09:56Z</dc:date>
    <item>
      <title>Erase tool in python fails when using a feature layer variable for an input</title>
      <link>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300275#M67984</link>
      <description>&lt;P&gt;Hello, I am wondering if this is a bug or my understanding of how this tool works is incorrect. I am running the code below in the python window of ArcGIS Pro 3.1.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gdbBuilding = r"C:\data\city.sde\buildings"
buildingLayer = "buildingLyr"
erase_features = r"C:\data\city.sde\feature_buffer200ft"
temp = arcpy.env.scratchGDB + "\\temp"

arcpy.management.MakeFeatureLayer(gdbBuilding, buildingLayer, "VERIFIED = 1", "")
arcpy.analysis.Erase(buildingLayer, erase_features, temp)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I receive the following error:&lt;/P&gt;&lt;P&gt;arcgisscripting.ExecuteError: ERROR 160333: The table was not found.&lt;BR /&gt;Failed to execute (Erase).&lt;/P&gt;&lt;P&gt;If I type in the code to run the erase tool, when I get to the part for the first input, the intellisense/autocomplete presents an option for the name of the new Layer that was created. If I select it and use the other parameters the same as before, it runs without issue.&lt;/P&gt;&lt;P&gt;If I provide a string with the same value as the feature layer name variable, it works to my surprise. Variables that point directly to a feature class also work fine.&lt;/P&gt;&lt;P&gt;I tested with the Buffer tool and it worked when using the feature layer name variable as an input.&lt;/P&gt;&lt;P&gt;Cany anyone reproduce this behavior? Should what I'm trying work?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 16:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300275#M67984</guid>
      <dc:creator>TonyContreras_Frisco_TX</dc:creator>
      <dc:date>2023-06-16T16:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Erase tool in python fails when using a feature layer variable for an input</title>
      <link>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300335#M67986</link>
      <description>&lt;P&gt;I changed the feature class to reference a different connection file (the first was a db user with read access to the database, the new connection uses Windows authentication and the user has read/write access) and that allowed things to work. I am not sure why one worked and another failed.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 18:09:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300335#M67986</guid>
      <dc:creator>TonyContreras_Frisco_TX</dc:creator>
      <dc:date>2023-06-16T18:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Erase tool in python fails when using a feature layer variable for an input</title>
      <link>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300392#M67990</link>
      <description>&lt;P&gt;Unrelated to your issue, but this line is not correct&lt;/P&gt;&lt;LI-CODE lang="python"&gt;temp = arcpy.env.scratchGDB + "\\temp"&lt;/LI-CODE&gt;&lt;P&gt;From the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/scratch-gdb.htm" target="_self"&gt;Scratch GDB documentation&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;The Scratch GDB environment is read-only; you cannot set the location directly.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Instead use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/scratch-workspace.htm" target="_blank" rel="noopener"&gt;Scratch Workspace&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;temp = arcpy.env.scratchWorkspace + "\\temp"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 20:30:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1300392#M67990</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2023-06-16T20:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Erase tool in python fails when using a feature layer variable for an input</title>
      <link>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1301050#M68001</link>
      <description>&lt;P&gt;I am not setting the location of the scratchGDB, rather I am setting a variable to a path that contains the scratchGDB location. The code below would be incorrect:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.scratchGDB = "C:\\Temp"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Jun 2023 13:50:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/erase-tool-in-python-fails-when-using-a-feature/m-p/1301050#M68001</guid>
      <dc:creator>TonyContreras_Frisco_TX</dc:creator>
      <dc:date>2023-06-20T13:50:35Z</dc:date>
    </item>
  </channel>
</rss>

