Dear All,
I am trying to do something very simple : listing the feature class stored in a shapefile. My first idea was to use the "ListFeatureClasses" function as I usually do with GDB files. However this return an empty list
my_shp = r"mydir\my_shapefile.shp"
arcpy.env.workspace = my_shp
arcpy.ListFeatureClasses()
# this does not work and returns []
However, when I use the "Walk" function, I am able to retrieve the feature classe :
walk = arcpy.da.Walk(my_shp, datatype="FeatureClass", type="Polygon")
feature_classes = []
for dirpath, dirnames, filenames in walk:
for filename in filenames:
feature_classes.append(os.path.join(dirpath, filename))
feature_classes
## this indeed returns me the fullpath to my feature classes
# [mydir\my_shapefile.shp\fcname]Why is the "ListFeatureClasses" function not returning "[fcname]" in this case ?
Is it another "List[...]" function (or another arcpy function) that would directly return "[fcname]" for this shapefile to alleviate the need to iterate over a walk ?
Sorry, it's surely a naive question, but I am quite new to arcpy and shapefiles especially...
Thanks in advance if you have any suggestion...