Skip to content

Conversation

TsKyrk
Copy link
Contributor

@TsKyrk TsKyrk commented Aug 25, 2023

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.

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.
Copy link
Owner

@x4nth055 x4nth055 left a 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.

@x4nth055 x4nth055 merged commit bf1862e into x4nth055:master Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants