bharadwaj-raju / WeatherDesk

MOVED: https://gitlab.com/bharadwaj-raju/WeatherDesk
https://gitlab.com/bharadwaj-raju/WeatherDesk
GNU General Public License v3.0
217 stars 31 forks source link

TypeError: 'NoneType' object is not subscriptable #29

Closed RicardoEPRodrigues closed 6 years ago

RicardoEPRodrigues commented 7 years ago

To put it in simple terms it crashes.

In more detail, first it didn't have a needed dependency for the file psutil, that I solved by running sudo apt install python3-psutil.

But now it crashes with the following:

[City checking] No error.
[Main loop] 
Traceback (most recent call last):
  File "WeatherDesk.py", line 396, in <module>
    weather = str(weather_json['query']['results']['channel']['item']['condition']['text']).lower()
TypeError: 'NoneType' object is not subscriptable
bharadwaj-raju commented 7 years ago

Yes, sometimes that error occurs. It's a problem on the API's end, nothing we can do.

Try a few test runs with --one-time-run.

RicardoEPRodrigues commented 7 years ago

WeatherDesk.py: error: unrecognized arguments: --one-time-run

What am I doing wrong? xD

Note: the program doesn't crash, but it also doesn't change the background...

bharadwaj-raju commented 7 years ago

What am I doing wrong? xD

Sorry, my bad. The --one-time-run is a new feature that is as-yet not pushed to GitHub (but it will be in a few minutes).

Then just download the latest and run it again.

bharadwaj-raju commented 7 years ago

Now I've updated it, please try again with latest.

RicardoEPRodrigues commented 7 years ago

Updated and it ran it as you requested.

I noted inconsistent output. Sometimes it works, sometimes it doesn't...

When it doesn't it shows the error previously mentioned.

bharadwaj-raju commented 7 years ago

Can you try visiting this URL in your browser?

https://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20geo.places(5)%20where%20text%3D"CITY"&format=json

Replacing CITY for your city.

This is the exact URL where WeatherDesk queries Yahoo! Weather for information.

RicardoEPRodrigues commented 7 years ago

I always receive the same result: result.txt

No error from that link.

bharadwaj-raju commented 7 years ago

For a possible solution, try increasing --wait from the default of 600 seconds.

RicardoEPRodrigues commented 7 years ago

I tried to increase the wait time to 2000 and ran a few --one-time-run, but it's still inconsistent.

RicardoEPRodrigues commented 7 years ago

Let me just say, it the errors doesn't break the app and just means that one update failed, then I won't worry and just use it as is.

bharadwaj-raju commented 7 years ago

I, too, would really like to fix this but cannot as it happens on what seems to be a random basis.

RicardoEPRodrigues commented 7 years ago

I don't know if I should close the issue, since it is not resolved... Maybe you should tag it as a WontFix and close it.

bharadwaj-raju commented 7 years ago

Should I close this issue?