AnsweredAssumed Answered

List subtypes Error Returned without Exception

Question asked by rralbritton on Aug 15, 2017
Latest reply on Aug 15, 2017 by bixb0012

I am trying to loop through my entire SDE database to give me a list of all active subtypes. 

I've adapted this script as a starting point. If I specify a unique feature class explicitly, the script works

i.e.

    subtypes = arcpy.da.ListSubtypes(r"\\ad.utah.edu\sys\FM\gis\ags_10_3\ags_content\sde_connection_files\sdeadmin@fm-sqlsrcvrtest.fm.utah.edu.sde\uusd.DBO.Lighting\UUSD.DBO.lighting")

    for stcode, stdict in list(subtypes.items()):
        print('Code: {0}'.format(stcode))
        for stkey in list(stdict.keys()):
            if stkey == 'FieldValues':
                fields = stdict[stkey]
                for field, fieldvals in list(fields.items()):
                    if not fieldvals[1] is None:
                        print fieldvals[1].name
           

 

however, if I loop it through feature classes within feature datasets, it goes those most of them but keeps getting stuck on a specific feature class (the same feature class that does work in the above example).

 

for fds in arcpy.ListDatasets('*lighting*'):  
        for fc in arcpy.ListFeatureClasses('','',fds):
            print "\n" + fc
            subtypes = arcpy.da.ListSubtypes(fc)
            for stcode, stdict in list(subtypes.items()):
                print('Code: {0}'.format(stcode))
                for stkey in list(stdict.keys()):
                    if stkey == 'FieldValues':
                        fields = stdict[stkey]
                        for field, fieldvals in list(fields.items()):
                            if not fieldvals[1] is None:
                                print fieldvals[1].name

PYTHON ERRORS:
Traceback info:
  File "C:\Users\u6003632\Google Drive\GIS_Files\Python\Python_Scripts\print_subtypes.py", line 27, in <module>
    subtypes = arcpy.da.ListSubtypes(fc)

Error Info:
error return without exception set                      

 

 The feature class is versioned. I'm not sure what the difference is - and why it only throws the error on this fc but it will work when it is a standalone. What the difference? 

Outcomes