The problem is because
int tries to convert
'' to a base 10 number, which is not possible. Thats why it is failing. You are getting the default
'' if the value is not there like this
instead of that use a sentinel value like this
Even better, you can convert them to numbers as and when you get them from the form like this
res12 = int(form.getvalue('opt_12', '0')) ... ... ...
solved ValueError: invalid literal for int() with base 10: ” python [closed]