Python - Flask Assistance Needed (too many values to unpack (expected 1) line 21 of app.py

I’ve pretty much finished the final project but a few bugs remain. In particular line 21 of app.py I’m getting to many values to unpack and can’t understand why. Code link here➡️ Codecademy export · GitHub

Also, it would help me a lot to be able to run terminal “print” statements when trying to debug code. Is there a way to view the terminal when CodeAcademy is displaying the web browser view?

Any help would be a big help, thanks!

Generally that error suggests that the number of things on each side of the assignment isn’t the same; in this case, you’re trying to unpack multiple things into one object.

You may need to use something like a list comprehension to get what I presume is your intended behaviour (though I’m not familiar with Flask, so this is a bit of a guess):

if request.method == "POST":
    [(name, action) for name, action in request.form.items()]
1 Like

Thank you very much!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.