<?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: some stranges occurred when a  featureclass in the same named dataset in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332785#M68762</link>
    <description>&lt;P&gt;I have add a test gdb. If both of the featureclasses in dataset all not named as the same name with dataset, it correct, but when one featureclass is named same as dataset, it will print another featureclass's fields.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 02:20:36 GMT</pubDate>
    <dc:creator>pyfans</dc:creator>
    <dc:date>2023-09-27T02:20:36Z</dc:date>
    <item>
      <title>some stranges occurred when a  featureclass in the same named dataset</title>
      <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332230#M68756</link>
      <description>&lt;P&gt;there is a dataset named "DT" in geodatabase and two featureclasses named "A" and "DT" in the dataset,&amp;nbsp; and My code is:&lt;/P&gt;&lt;P&gt;arcpy.env.workspace=gdb&lt;/P&gt;&lt;P&gt;dts=arcpy.ListDatasets()&lt;/P&gt;&lt;P&gt;for dt in dts:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;fcs=arcpy.ListFeatureClasses(feature_dataset=dt)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for fc in fcs:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;c=arcpy.GetCount_management(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fis=arcpy.ListFields(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fnames=[f.name for f in fis]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; arcpy.AddMessage('{} {} {}'.format(fc,c[0],';'.join(fnames))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After run this code, it'll print the correct name and count for both featureclasses but wrong for&amp;nbsp; 'DT' featureclass's fields,&amp;nbsp; as get the same as&amp;nbsp; 'A' featureclass, not actually 'DT' itself's.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I use 10.8.2.&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 01:47:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332230#M68756</guid>
      <dc:creator>pyfans</dc:creator>
      <dc:date>2023-09-26T01:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: some stranges occurred when a  featureclass in the same named dataset</title>
      <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332332#M68759</link>
      <description>&lt;P&gt;I'm really surprised that you can have a featureclass inside a featuredataset with the same name as the featuredataset. As a first test try renaming the DT featureclass to something else then run your code, what do you get then?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 10:58:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332332#M68759</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2023-09-26T10:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: some stranges occurred when a  featureclass in the same named dataset</title>
      <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332473#M68761</link>
      <description>&lt;P&gt;I haven't heard about any rule prohibiting&amp;nbsp; feature class from having the same name as feature dataset - if there is one could you please provide source? Definitely you cannot have 2 feature classes with the same name in different datasets.&lt;/P&gt;&lt;P&gt;Back to the code - it worked well for me, but I have ArcGIS Pro, so there might be some specific bug in ArcMap. For clarity I put the code again in formatted way (please note that there is a missing parenthesis at the end of the original code by leigao):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.workspace=gdb
dts=arcpy.ListDatasets()
for dt in dts:
    fcs=arcpy.ListFeatureClasses(feature_dataset=dt)
    for fc in fcs:
        c=arcpy.GetCount_management(fc)
        fis=arcpy.ListFields(fc)
        fnames=[f.name for f in fis]
        print ('{} {} {}'.format(fc,c[0],';'.join(fnames))) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 15:30:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332473#M68761</guid>
      <dc:creator>SzymAdamowski</dc:creator>
      <dc:date>2023-09-26T15:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: some stranges occurred when a  featureclass in the same named dataset</title>
      <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332785#M68762</link>
      <description>&lt;P&gt;I have add a test gdb. If both of the featureclasses in dataset all not named as the same name with dataset, it correct, but when one featureclass is named same as dataset, it will print another featureclass's fields.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 02:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1332785#M68762</guid>
      <dc:creator>pyfans</dc:creator>
      <dc:date>2023-09-27T02:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: some stranges occurred when a  featureclass in the same named dataset</title>
      <link>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1348367#M69219</link>
      <description>&lt;P&gt;Sorry for long time in responding. I tested your&amp;nbsp; code and database in ArcGIS Pro (3.2). Works well. If it doesn't work well in ArcMap then it might be ArcMap-specific bug. Code looks OK.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SzymAdamowski_0-1699702553928.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/85674iA9FA191527C608A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SzymAdamowski_0-1699702553928.png" alt="SzymAdamowski_0-1699702553928.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 11:36:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/some-stranges-occurred-when-a-featureclass-in-the/m-p/1348367#M69219</guid>
      <dc:creator>SzymAdamowski</dc:creator>
      <dc:date>2023-11-11T11:36:49Z</dc:date>
    </item>
  </channel>
</rss>

