if not self.centerline.isNull(suffix): self.newStreet.S_suffix = self.centerline.getValue(suffix)
if self.centerline.getValue(suffix) is not None: self.newStreet.S_suffix = self.centerline.getValue(suffix)
fields = ['fld1', 'fld2', 'fld3'] for field in fields: where = field + " IS NOT NULL" try: with arcpy.da.SearchCursor(fc, fields, where) as cursor: for row in cursor: value = row[0] print field + ": " + str(value) #or use "value" to do something except Error: pass del row, cursor
I have not run into this specifically, but what about putting in some error handling to allow your code to continue on past these rows?Implement the Try-Except block statement.Regards,Jim
try: if not self.centerline.isNull(name): self.newStreet.S_name = self.centerline.getValue(name) except: pass try: if not self.centerline.isNull(prefix): self.newStreet.S_prefix = self.centerline.getValue(prefix) except: pass try: if not self.centerline.isNull(suffix): self.newStreet.S_suffix = self.centerline.getValue(suffix) except: pass try: if not self.centerline.isNull(type): self.newStreet.S_type = self.centerline.getValue(type) except: pass
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.