import arcpy, os arcpy.env.workspace = os.getcwd() # shapefile that contains hyperlink shp = "myfile.shp" # Create SearchCursor for feature class. rows = arcpy.SearchCursor(shp) for row in rows: # Get the path to the file from field 'hyperlink' path = row.getValue("hyperlink") # Does that file exist? if os.path.exists(path): print "Link is OK: "+path else: print "BROKEN LINK!: "+path del rows
import arcpy, os arcpy.env.workspace = os.getcwd() # Feature Class that contains PHOTOS field shp = "Z:\ESRI\Geodatabase\TEST.gdb\point_FC" # Create SearchCursor for feature class. rows = arcpy.SearchCursor(shp) for row in rows: # the print path syntax works fine, it's the count that fails.... path = row.getValue("PHOTOS") print path if path != "N/A": arcpy.GetCount_management(row) del rows
Mike, I'm confused, what are you trying to get a count of?
Hey R.D. Thanks a bunch for the tip. I had used this method earlier but I kept getting error. I had narrowed it down to the !=. The selectbyattributes where clause does not like that operator for NOT EQUALS, which is weird, because I have used it in other SQL queries in python.After your post, I finally clued in to use <> and that works perfectly. Sometimes it's nice to just have someone jog your memory!
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.