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
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.