How Do You Troubleshoot the Flask Message “LookupError: the converter ‘str’ does not exist”?

Problem scenario
You are trying to pass a string parameter to a Flask application via a call to a URL. You get the message "LookupError: the converter 'str' does not exist." What should you do?

Solution
Use the term "string" instead of "str".

Here is an example of incorrect syntax:
@app.route("/ccc/", strict_slashes=False)

This shows the correct syntax:
@app.route("/ccc/", strict_slashes=False)

Leave a comment

Your email address will not be published. Required fields are marked *