Session Four
Session Six

Session Five(ish)

There was no session five today as the pupils were otherwise engaged. So instead I sat and continued to look at the python code and try and work out just what was causing it to crash when pulling the weather data.

The scratch program always started properly, but then crashed when the second set of city data was called for. No matter what I looked at I could not work out why. Eventually, out of sheer frustration I removed the second city from the list of place names and tried again.

Success! The program ran correctly. But I still had no idea what was going on. I left the program running, became distracted and then turned back to the screen later on to see that the python had once again crashed at some point. 

Where? I wasn't sure, so I restarted everything after adding an extra scratch block that let me use the space bar to cycle through cities quickly.

Sydney worked fine. New York had been removed. Leicester worked fine. Berlin worked fine. Anchorage worked fine. Las Palmas... Las Palmas broke the code once again. 

I removed Las Palmas from the list of locations and reset everything for a third try. Sydney, Leicester, Berlin, Anchorage, Paris, Edinburgh Cardiff. The program worked without error, and looped back to the beginning and repeated without fault.

So what were New York and Las Palmas doing to break everything? What did they have in common? Finally I realised. They were both two word cities. Cities with a space as a character within them. The python code didn't like sending an empty character as part of the data. Simple as that.

And so, without wanting to change the New York and Las Palmas slides in the scratch program, the locations were simply changed to Manhattan and Tenerife (one word locations that wouldn't cause an issue).

Bug squashed. Program working. Finally!