I am trying to list all feature classes from multiple datasets with single GDB. I have tried with below code
import arcpy
from arcpy import env
env.workspace = r"C:\GDB\Base.gdb"
fdlist = arcpy.ListDatasets("*","feature")
for fd in fdlist:
print fd
env.workspace = fd
fclist = arcpy.ListFeatureClasses()
for fc in fclist:
print(fc)
Lists a few feature classes in first dataset then display below error.I have found some scripts that works for single dataset.
Traceback (most recent call last):
File "C:\SOFTWARE\Arcpy\Arcpy_Script\List_fc.py", line 47, in
for fc in fclist:
TypeError: 'NoneType' object is not iterable
Best Answer
This will list all feature classes, inside a dataset and just sitting in the root of the geodatabase. It works with empty datasets. It works with an empty root. If you don't want to search the root, just leave the second part out.