Hello Dynamo Friends
I want to set parameters of sheets.
For sheets that are blocked by other users I would like to throw an error message.
The problem is that I can not catch the error and also the result of .Set() always returns True, no matter if it works or fails. Is there any way to check if the sheet is accessible before setting the parameter?
def update_parameter(sheet, param, param_name, current_value, new_value):
t = Transaction(doc, "Set Sheet Parameter")
t.Start()
try:
print("Attempting to update: " + sheet.Name)
success = param.Set(new_value)
if success:
print("Updated: " + sheet.Name + " for " + param_name + " from " + str(current_value) + " to " + str(new_value))
else:
print("Update failed: " + sheet.Name + " for " + param_name)
t.Commit()
except Exception as e:
print("ERROR: " + sheet.Name + " for " + param_name + " from " + str(current_value) + " - Exception: " + str(e))
t.RollBack()