Skip to content

KeyError- KeyError: 'name' #5439

Answered by davidism
Tasfinthebigboy asked this question in Q&A
Discussion options

You must be logged in to vote

This is a common Python problem, unrelated to Flask. If you're not sure if a key ('name') is in a dict (session), you should use 'name' in session to check, or use session.get('name') which will return None rather than a key error if it's missing.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tasfinthebigboy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants