<?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: arcpy.ListFeatureClasses() Problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191682#M14726</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alright, that is really bizarre.&amp;nbsp; You're right, that code will only loop through one dataset?!?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The data I originally tested it on only had one dataset so I never noticed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if that's a bug or what but it doesn't work in 10.0 or 10.1!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, if you do it like this, it will work...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os


arcpy.env.workspace = os.getcwd()


# For each ws, print the fc's and tbl's.
for ws in arcpy.ListWorkspaces("*", "FileGDB"):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ws
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in arcpy.ListFeatureClasses():&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "fc: "+fc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbl in arcpy.ListTables():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "tbl: "+tbl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes in datasets
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ds in arcpy.ListDatasets():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ds: "+ds&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dfc in arcpy.ListFeatureClasses("*", "All", ds):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "fc in ds: "+dfc
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:38:05 GMT</pubDate>
    <dc:creator>RDHarles</dc:creator>
    <dc:date>2021-12-11T09:38:05Z</dc:date>
    <item>
      <title>arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191675#M14719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To All Python Users:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a python script with arcpy.ListFeatureClasses() that I wanted to use to get a list of all feature classes in a file geodatabase.&amp;nbsp; This method has worked perfectly in the past, but I have encountered a scenario where it does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this scenario I have a file geodatabase with a feature dataset that has the same name as a feature class.&amp;nbsp; When I run the python script it does not include this feature class in the list.&amp;nbsp; If I change the name of the feature class, the python script adds the feature class name to the list.&amp;nbsp; This is not my data, so I cannot change the name of the feature class in production.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone encountered this issue with arcpy.ListFeatureClasses()?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help or feedback is greatly appreciated.&amp;nbsp; Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 16:03:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191675#M14719</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-04-23T16:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191676#M14720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a quick test, I was not able to reproduce this.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; What version of ArcGIS (including service packs) are you running?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; What version is the file geodatabase?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; Can you reproduce this on other file geodatabases?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 17:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191676#M14720</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2013-04-23T17:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191677#M14721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are setting the workspace to your feature dataset 1st (in order to list the FCs there) right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have v10.1 SP1, I have found the new arcpy.da.walk function to be very handy: &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 17:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191677#M14721</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-04-23T17:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191678#M14722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is how I've always done it...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# For each ws, print the fc's and tbl's.
for ws in arcpy.ListWorkspaces("*", "FileGDB"):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ws
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in arcpy.ListFeatureClasses():&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbl in arcpy.ListTables():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes in datasets
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ds in arcpy.ListDatasets():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ds
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dfc in arcpy.ListFeatureClasses():&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print dfc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191678#M14722</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T09:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191679#M14723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;If you have v10.1 SP1, I have found the new arcpy.da.walk function to be very handy: &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How's it going, Chris!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Haven't played with the arcpy.da stuff.&amp;nbsp; Looks like it can replace my old system walk stuff.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os, subprocess


for root, dirs, files in os.walk(os.getcwd()):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for dir in dirs:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dir.endswith(".gdb"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fullpath = os.path.abspath(os.path.join(root, dir))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "\nfullpath: "+fullpath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "dir: "+dir
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191679#M14723</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T09:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191680#M14724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you R.D. Harles and Chris&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought I could get a list of all the feature classes in the file geodatabase, irregardless of whether they were in a feature dataset, from the ListFeatureClasses method, but I was incorrect.&amp;nbsp; This is very useful information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 12:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191680#M14724</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-04-24T12:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191681#M14725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have taken the following code and added it to my scripts to cycle through the Feature Datasets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for ds in arcpy.ListDatasets():&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ds&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dfc in arcpy.ListFeatureClasses():&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print dfc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, when I make the call to for dfc in arcpy.ListFeatureClasses(): in the loop for the 2nd dataset, the python script exits without any error message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would anyone know what I am missing for the script to execute properly against the 2nd Feature Dataset in the file geodatabase?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 15:44:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191681#M14725</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-04-24T15:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ListFeatureClasses() Problem</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191682#M14726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alright, that is really bizarre.&amp;nbsp; You're right, that code will only loop through one dataset?!?!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The data I originally tested it on only had one dataset so I never noticed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if that's a bug or what but it doesn't work in 10.0 or 10.1!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, if you do it like this, it will work...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os


arcpy.env.workspace = os.getcwd()


# For each ws, print the fc's and tbl's.
for ws in arcpy.ListWorkspaces("*", "FileGDB"):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ws
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in arcpy.ListFeatureClasses():&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "fc: "+fc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # tables
&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbl in arcpy.ListTables():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "tbl: "+tbl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # feature classes in datasets
&amp;nbsp;&amp;nbsp;&amp;nbsp; for ds in arcpy.ListDatasets():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "ds: "+ds&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dfc in arcpy.ListFeatureClasses("*", "All", ds):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "fc in ds: "+dfc
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:38:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-listfeatureclasses-problem/m-p/191682#M14726</guid>
      <dc:creator>RDHarles</dc:creator>
      <dc:date>2021-12-11T09:38:05Z</dc:date>
    </item>
  </channel>
</rss>

