Why does my Flask route listing function fail when I specify a converter for variable URLs? Why does my Flask route listing function fail when I specify a converter for variable URLs? flask flask

Why does my Flask route listing function fail when I specify a converter for variable URLs?


Yep, the only thing you should do is to check the variable type to avoid this.

see:

ValueError: invalid literal for int() with base 10: '[xyrange]'

you must have passed in a variable: '[xyrange]'.And it's a string.

You regulated the type of the url endpoint argument to integer, but you passed in other types. We all know that int methods can not change the string to integer.

So, check your argument's type before redirect, and if you can't confirm the type of the argument, don't use @app.route('xxx/<int:xxxx>'), buddy.