Skip to content

Commit

Permalink
edits to error messages in Fix Strings tool
Browse files Browse the repository at this point in the history
  • Loading branch information
ethoms-usgs committed Sep 8, 2021
1 parent f403857 commit 6bebf1d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Scripts/GeMS_FixStrings_AGP2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def fixTableStrings(fc):
updateRowFlag = False
row1 = [row[0]]
for i, f in enumerate(row[1:]):
#addMsgAndPrint(" ")
updateFieldFlag = False
f0 = f
if f != None:
Expand All @@ -33,13 +34,13 @@ def fixTableStrings(fc):
updateFieldFlag = True
if updateFieldFlag:
updateRowFlag = True
addMsgAndPrint(f" OID:{str(row[0])} field:{fields[i+1]} value:'{str(f0)}'")
#addMsgAndPrint(f" OID:{str(row[0])} field:{fields[i+1]} value:'{str(f0)}'")
row1.append(f)
if updateRowFlag:
try:
cursor.updateRow(row1)
except Exception as error:
addMsgAndPrint(f'Failed to update row {str(row[0])}. {error}')
arcpy.AddMessage(f'\u200B Row {str(row[0])}. {error}')

#########################

Expand All @@ -50,7 +51,7 @@ def fixTableStrings(fc):

tables = arcpy.ListTables()
for tb in tables:
addMsgAndPrint(' ')
addMsgAndPrint(".........")
addMsgAndPrint(os.path.basename(tb))
fixTableStrings(tb)

Expand All @@ -62,7 +63,7 @@ def fixTableStrings(fc):
path = os.path.join(arcpy.env.workspace, ds, fc)
try:
fixTableStrings(path)
except:
addMsgAndPrint(' failed to fix strings')
except Exception as error:
addMsgAndPrint(error)

addMsgAndPrint('DONE')

0 comments on commit 6bebf1d

Please sign in to comment.