SearchCursor - RuntimeError: cannot open - Feature Class

Discussion created by bwscim on Jul 23, 2017
Latest reply on Feb 12, 2019 by bharold-esristaff

I'm attempting to read a specific field from a Feature Class using the following code (search cursor):

import arcpy
import os

arcpy.env.workspace = 'C:\Users\jas\Documents\ArcGIS\L_Sr_geodatabase.gdb'

#inputFeatures = arcpy.GetParameterAsText(0)
inFeatures = 'LF_Stormdrains'

fc = os.path.join(arcpy.env.workspace,inFeatures)

# check if exist
if arcpy.Exists(fc):
   print "Feature Class Exists"

# check name
fc_list = arcpy.ListFeatureClasses()   

for fcname in fc_list: 

fields = ['ASSET_ID']

if arcpy.Exists(inFeatures):
     arcpy.AddMessage("Feature Class Exists...")

with arcpy.da.SearchCursor(fc, fields) as cursor:
          if != ():
               for row in cursor:
                    assetID = row[0]
     except StopIteration:
          print('Empty Cursor')

I'm stumped on the RuntimeError: cannot open 'feature class'.  Any help would be appreciated!