<?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: Why does search cursor within a custom toolbox delete feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/why-does-search-cursor-within-a-custom-toolbox/m-p/1331296#M68736</link>
    <description>&lt;P&gt;I figured it out. I must have accidentally set the parameter feature_class as an output instead of an input.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 23:17:12 GMT</pubDate>
    <dc:creator>ZacharyKasson</dc:creator>
    <dc:date>2023-09-21T23:17:12Z</dc:date>
    <item>
      <title>Why does search cursor within a custom toolbox delete feature class</title>
      <link>https://community.esri.com/t5/python-questions/why-does-search-cursor-within-a-custom-toolbox/m-p/1331291#M68735</link>
      <description>&lt;P&gt;I am trying to iterate through the attribute table to find duplicates of a field which is supposed to be a unique identifier. I figured I would use a tool to take in a parameter(feature class) as an argument for a search cursor, then append the result to a list. I was hoping to use that list to find duplicate values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have ran into a weird instance where the feature class I use as a parameter is deleted upon clicking the 'Run' button. Of course I then get an error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  File "Y:\Zack\Duplicate_stand_finder.atbx#DuplicateID_Duplicateidfinder.py", line 20, in &amp;lt;module&amp;gt;
RuntimeError: cannot open 'Y:\Zack\Default.gdb\Rand_points'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Here is the code that I tried for testing purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ids= []
feature_class = arcpy.GetParameterAsText(0)
field = arcpy.GetParameterAsText(1)

with arcpy.da.SearchCursor(feature_class, field) as cursor:
    for i in cursor:
        ids.append(i[0])
arcpy.AddMessage(ids)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 23:05:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-search-cursor-within-a-custom-toolbox/m-p/1331291#M68735</guid>
      <dc:creator>ZacharyKasson</dc:creator>
      <dc:date>2023-09-21T23:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why does search cursor within a custom toolbox delete feature class</title>
      <link>https://community.esri.com/t5/python-questions/why-does-search-cursor-within-a-custom-toolbox/m-p/1331296#M68736</link>
      <description>&lt;P&gt;I figured it out. I must have accidentally set the parameter feature_class as an output instead of an input.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 23:17:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-does-search-cursor-within-a-custom-toolbox/m-p/1331296#M68736</guid>
      <dc:creator>ZacharyKasson</dc:creator>
      <dc:date>2023-09-21T23:17:12Z</dc:date>
    </item>
  </channel>
</rss>

