Open MikeMillerGIS opened 7 years ago
The current fix Paul and I quickly worked up for this changes some code in dlaFieldCalculator.py (the file that crashes on this error)
try:
# printRow(row,names)
updateCursor.updateRow(row)
except:
error = traceback.format_exc()
error_field = re.findall(r"\[(.+)\]", error)
# Pulls the field name from the arcpy error message from updateCursor
if error_field:
error_value = row[names.index(error_field[0])]
error = "{} Value: {}".format(error, error_value)
dla.addError(error)
if True:
sys.exit(1)
This will quit after the first updateCursor row crash and prints out a message like this:
Here the user can see which field caused the crash and what value was the culprit. In this way the user can quickly determine the cause and amend it without having to deal with incorrect appendages and unneeded digging.
The "if True:" here is for the potential that the user can choose whether or not they'd like the script to continue running on this first error or not.
Looks good.
@MikeMillerGIS this was merged, issue can be closed.
@gg7aph encountered this when he did not properly define all his domain maps. A string was attempted to be set into an int field. Execution should stop and inform the user of the error so they can correct the process.