Weather-phat

i use raspbary py zero 2 w with phat, and then run the program.
python3 /home/akio/Pimoroni/inky/examples/phat/weather-phat.py
But print time out error.How I can change? Please teach me.
Akio

Status code Unknown from https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find: ERROR - HTTPSConnectionPool(host=‘geocode.arcgis.com’, port=443): Read timed out. (read timeout=5.0)
Traceback (most recent call last):
File “/home/akio/Pimoroni/inky/examples/phat/weather-phat.py”, line 112, in
weather = get_weather(location_string)
File “/home/akio/Pimoroni/inky/examples/phat/weather-phat.py”, line 73, in get_weather
res = requests.get(“https://api.open-meteo.com/v1/forecast?latitude=” + str(coords[0]) + “&longitude=” + str(coords[1]) + “&current_weather=true”)
TypeError: ‘NoneType’ object is not subscriptable

That error looks like the example is struggling to connect to the weather API, does this happen every time?

Is your Pi connected to the internet?

That error is the example is having trouble connecting to the weather API. I can connect once in 5 times.

The Pi is connected to the internet via Wi-Fi.
Akio

From the trace, it seems that geocode.arcgis.com has a problem. Not open-meteo.

You could add your latitude and longitude manually to this line (and comment out the coords = line) if you’re having trouble with the geocoder library/arcgis:

Thank you very much. I appreciate it.

1 Like