Python script listing feature classes lists FC not in Arc Catalog

411
1
11-24-2022 09:25 AM
Labels (2)
tslack
by
New Contributor III

Hey folks,

I am trying to run a script that looks for unused domains in our SDE. It was complaining about an FC that didnt exist and crashed so I am trying to isolate the error down.

 

import arcpy, os

# get the SDE connection as a variable
sdeConnection = "Database Connections\\cityfsj on sqlserver dataowner EditVersion.sde"


allFcsAndTables = []
walk = arcpy.da.Walk(sdeConnection, datatype=["FeatureClass", "Table"])
for dirpath, dirname, filenames in walk:
    for filename in filenames:
        allFcsAndTables.append(os.path.join(dirpath, filename))
        with open(r'c:\data\test.txt', 'w') as fp:
            for item in allFcsAndTables:
                # write each item on a new line
                fp.write("%s\n" % item)
            print('Done')
# clean up the walk object
del walk

 

Running this lists a feature class that I cannot for the life of me find in Arc Catalog of SQL manager looking at the tables.

Anyone know what leftovers would cause it to list in this script but be missing else where?

Thanks

Tags (2)
0 Kudos
1 Reply
tslack
by
New Contributor III

Running Diagnose Version Tables seems to have resolved it? I was able to create an FC with the same name and delete it after running it. Not sure why or how this even happened in the first place but thats it was fixed for anyone that finds this through google.

0 Kudos