From 4767cfd0f306650f185c8b196fa02754db9d827a Mon Sep 17 00:00:00 2001 From: TsKyrk <121832766+TsKyrk@users.noreply.github.com> Date: Fri, 25 Aug 2023 22:34:11 +0200 Subject: [PATCH] Update interactive_weather_plot.py 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. --- general/interactive-weather-plot/interactive_weather_plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/general/interactive-weather-plot/interactive_weather_plot.py b/general/interactive-weather-plot/interactive_weather_plot.py index b4d17141..3d1ea566 100644 --- a/general/interactive-weather-plot/interactive_weather_plot.py +++ b/general/interactive-weather-plot/interactive_weather_plot.py @@ -68,7 +68,7 @@ def changeLocation(newLocation): # Making the Radio Buttons buttons = RadioButtons( ax=plt.axes([0.1, 0.1, 0.2, 0.2]), - labels=locations.keys() + labels=list(locations.keys()) ) # Connect click event on the buttons to the function that changes location. @@ -86,4 +86,4 @@ def changeLocation(newLocation): plt.savefig('file.svg', format='svg') -plt.show() \ No newline at end of file +plt.show()