photo_field = "your_path_field" curs = arcpy.SearchCursor(fc,"","",photo_field) for row in curs: photo_path = row.getValue(photo_field) if os.path.exists(photo_path): print "%s exists" % os.path.basename(photo_path) else: print "%s not found" % os.path.basename(photo_path)
import arcpy import os featureClass = arcpy.GetParameterAsText(0) photo_field = "PhotoHotlink" results_field = "PhotoExists" curs = arcpy.UpdateCursor(featureClass, "", "", [photo_field, results_field]) #row = curs.next() for row in curs: photo_path = row.getValue(photo_field) if os.path.exists(photo_path): row.setValue(results_field, "Y") else: row.setValue(results_field, "N") curs.updateRow(row) #row = curs.next() del curs, row
import arcpy import os featureClass = arcpy.GetParameterAsText(0) photo_field = "PhotoHotlink" results_field = "PhotoExists" curs = arcpy.UpdateCursor(featureClass, results_field) row = curs.next() for row in curs: photo_path = row.getValue(photo_field) if os.path.exists(photo_path): row.setValue(results_field, "Y") else: row.setValue(results_field, "N") curs.updateRow(row) row = curs.next() del curs, row
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.