KeyError- KeyError: 'name' #5439
-
Traceback (most recent call last):
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is a common Python problem, unrelated to Flask. If you're not sure if a key ( |
Beta Was this translation helpful? Give feedback.
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 usesession.get('name')
which will returnNone
rather than a key error if it's missing.