CrazeeIvan / python-weather-api

Automatically exported from code.google.com/p/python-weather-api
MIT License
0 stars 0 forks source link

UnicodeDecodeError in get_woeid_from_yahoo() #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The JSON response from yahoo is incorrectly decoded in get_woeid_from_yahoo():

Traceback (most recent call last):
  File "/usr/bin/indicator-weather", line 2690, in next_page
    (result, error_type) = self.location.prepare_location(self.place_selected)
  File "/usr/bin/indicator-weather", line 360, in prepare_location
    self.prepare_location_for_yahoo(geonames_details)
  File "/usr/bin/indicator-weather", line 430, in prepare_location_for_yahoo
    woeid_result = pywapi.get_woeid_from_yahoo(displayed_city_name)
  File "/usr/lib/python2.7/dist-packages/pywapi.py", line 906, in get_woeid_from_yahoo
    json_response = handler.read().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 121: 
ordinal not in range(128)

To fix, just change the referenced line to:
json_response = handler.read()

(i.e. don't call .decode() on the response)

Original issue reported on code.google.com by jtas...@gmail.com on 16 Jul 2013 at 4:46

GoogleCodeExporter commented 8 years ago
Fix is committed, will be released with 0.3.4.

Original comment by jtas...@gmail.com on 16 Jul 2013 at 4:47