I am trying to obtain a list of feature classes in an ArcGIS Project file. I get the error below;
*** Remote Interpreter Reinitialized ***
Traceback (most recent call last):
File "<module1>", line 19, in <module>
NameError: name 'glob' is not defined
I am trying the code below. I know the code below does not include the CSV code part, if someone can help with that too.
import arcpy
import os
aprx_dir = r'H:\007_Services-GViewer\02_GViewer_Updates\2201xx_Engineering\STG_MXDs\New folder\*.aprx'
aprx_dict = {}
for aprx_file in glob.glob(aprx_dir):
aprx = arcpy.mp.ArcGISProject(aprx_file)
for m in aprx.listMaps():
for layer in m.listLayers():
if layer.supports("DATASOURCE"):
ds = layer.dataSource
if ds not in aprx_dict:
aprx_dict[ds] = [aprx_file]
elif aprx_file in aprx_dict[ds]:
pass
else:
aprx_dict[ds].append(aprx_file)
glob
error, addimport glob
to import section.