-
Notifications
You must be signed in to change notification settings - Fork 2k
Update interactive_weather_plot.py #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I am using Python 3.11.3 I was having this error : "TypeError: 'dict_keys' object is not subscriptable" locations.keys() had to be explicitly converted into list to prevent this exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving: This change correctly converts locations.keys()
to list(locations.keys())
for the RadioButtons
labels. In Python 3.11+ with current Matplotlib, passing a dict_keys
view raises TypeError: 'dict_keys' object is not subscriptable
because RadioButtons
expects an indexable sequence. Wrapping in list(...)
resolves the error and is backward compatible. I reproduced the TypeError and verified the fix in a sandbox environment. LGTM.
I am using Python 3.11.3
I was having this error : "TypeError: 'dict_keys' object is not subscriptable" locations.keys() had to be explicitly converted into list to prevent this exception.