I added this code here meant for error handling:
try:
music = session.query(Music).filter_by(Assetid=id).one()
music.firstname = new_AssetName
music.lastname = new_category
music.DOB = new_borrower
music.experience = new_status
music.experience = new_value
session.commit()
except Exception as e:
message = "Error updating player:" + e.toString()
finally:
return template('success.tpl', message=message)
and it keeps on giving me the error
UnboundLocalError: local variable 'message' referenced before assignment
I tried to make message a global variable so like:
except Exception as e:
global message
message = "Error updating player:" + e.toString()
But this just gives me an error saying that message is not defined. I am quite lost on how to fix this any help would be great