Python Forum
Error loading location on openweathermap via API with Kivy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error loading location on openweathermap via API with Kivy
#5
I changed the function is:
  def found_location(self, request, data):
    data = json.loads(data.decode()) if not isinstance(data, dict) else data 
    print(type(data), data)
    cities = ["{} ({})".format(d['name'], d['sys']['country']) for d in data['list']] 
    self.search_results.item_strings = cities
The result is:
You searched for: 'Vancouver'
<class 'dict'> {'coord': {'lon': -122.67, 'lat': 45.63}, 'weather': [{'id': 500, 'main': 'Rain', 'description': 'light rain', 'icon': '10d'}], 'base': 'stations', 'main': {'temp': 292.03, 'pressure': 1023, 'humidity': 55, 'temp_min': 289.15, 'temp_max': 294.26}, 'visibility': 16093, 'wind': {'speed': 1.5, 'deg': 360}, 'rain': {'1h': 0.25}, 'clouds': {'all': 40}, 'dt': 1555614246, 'sys': {'type': 1, 'id': 5321, 'message': 0.0088, 'country': 'US', 'sunrise': 1555593581, 'sunset': 1555642796}, 'id': 5814616, 'name': 'Vancouver', 'cod': 200}
Traceback (most recent call last): ... etc
Reply


Messages In This Thread
RE: Error loading location on openweathermap via API with Kivy - by Gigux - Apr-18-2019, 07:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error when running kivy on python janeik 8 2,296 Jun-16-2023, 10:58 PM
Last Post: janeik
  Error loading Trelby.py blackclover 3 2,604 Jan-05-2021, 10:08 PM
Last Post: blackclover
  import error (unknown location) pseudo 1 10,879 Nov-14-2019, 11:47 PM
Last Post: pseudo
  kivy - packaging touchtracer syntax error cram 2 2,624 Oct-14-2019, 08:30 PM
Last Post: cram
  Getting error while loading excel(.xlsx) file using openpyxl module shubhamjainj 1 9,120 Mar-01-2019, 01:05 PM
Last Post: buran
  error creating new object after loading pickled objects from file arogers 2 3,550 Feb-02-2019, 10:43 AM
Last Post: Larz60+
  PyQt5 No Error But GUI Window Not Loading digitalmatic7 1 4,372 Nov-21-2017, 05:23 PM
Last Post: digitalmatic7
  Error while loading the csv file Analyst 3 10,342 Oct-18-2017, 07:07 AM
Last Post: Analyst
  'NoneType' object has no attribute error, when using Kivy Screens chelovek 3 11,259 Feb-05-2017, 05:37 AM
Last Post: chelovek

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020