Hi all,
I am running into something really weird and I was wondering if anyone could tell me what's happening here.
I have a coverage that I'm trying to describe.

fdList = arcpy.ListDatasets()
# Print feature classes in Datasets
if fdList:
for fd in fdList:
print(fd)
desc= (arcpy.da.Describe(fd))
#print(desc)
print(desc['catalogPath'], desc['datasetType'])
if desc['datasetType'] == "FeatureDataset":
print("true")
''' Yields:'''
# T:\...\nhd FeatureDataset
# true
# T:\...\nhdpt FeatureDataset
# true
# T:\...\nhdduu FeatureDataset
# true
However, if I try to do anything with it, I get an error:
if fdList:
for fd in fdList:
#print(fd)
desc= (arcpy.da.Describe(fd))
#print(desc)
print(desc['catalogPath'], desc['datasetType'])
if desc['datasetType'] == "FeatureDataset":
print("true")
if desc['datasetType'] == "FeatureDataset":
arcpy.env.workspace = os.path.join(dirP, fd)
fdFCList =arcpy.ListFeatureClasses()
if fdFCList:
for fc in fdFCList:
fList.append([os.path.join(dirP, fd, fc)])
'''Yields:''
# T:\...\nhd FeatureDataset
# true
# ---------------------------------------------------------------------------
# ValueError Traceback (most recent call last)
Line 4: desc= (arcpy.da.Describe(fd))
ValueError: Object: Error in accessing describe
In short, it'll do the first one or two feature datasets, then it'll break somehow.
Sometimes it does just the first, sometimes it does the first two.
Has anyone encountered anything like this before?
Thanks!
Edit: It looks like it has to do with setting the environment. How do I fix this? It worked fine for feature datasets in GDBs.