HackerShackOfficial / Smart-Mirror

Raspberry powered mirror which can display news, weather, calendar events
MIT License
908 stars 384 forks source link

JSON object #77

Closed marcoleder closed 6 years ago

marcoleder commented 6 years ago

Hi guys

So I have the newest version of the repository, the program works, but I dont get the weather. I read every single issue about the weather and also the closed ones and modified my code. Still it doesnt work. This is the output I get:

Traceback (most recent call last): File "smartmirror.py", line 158, in get_weather weather_obj = json.loads(r.text) File "/usr/lib/python2.7/json/init.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded Error: No JSON object could be decoded. Cannot get weather. root@rp:/home/pi/Smart-Mirror#

Due to the fact that this is my topic on my half year presentation I would really appreciate any inputs and advice.

Best regards and already a big thanks

MudassirKazmi commented 6 years ago

Have u included the API token..?

Regards, Mudassir Kazmi

On Thu, Oct 12, 2017 at 3:27 PM, vb cgn notifications@github.com wrote:

Hi guys

So I have the newest version of the repository, the program works, but I dont get the weather. I read every single issue about the weather and also the closed ones and modified my code. Still it doesnt work. This is the output I get:

Traceback (most recent call last): File "smartmirror.py", line 158, in get_weather weather_obj = json.loads(r.text) File "/usr/lib/python2.7/json/init.py", line 338, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded Error: No JSON object could be decoded. Cannot get weather. root@rp:/home/pi/Smart-Mirror#

Due to the fact that this is my topic on my half year presentation I would really appreciate any inputs and advice.

Best regards and already a big thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HackerHouseYT/Smart-Mirror/issues/77, or mute the thread https://github.com/notifications/unsubscribe-auth/AbC0Dp_QeKdkswfIqLT6tGIvYKDJyxJCks5sremigaJpZM4P2y6i .

marcoleder commented 6 years ago

Yes, I added the API in the field Token, deleted < and > but left it in a string. I also substituted %s in the url with the token. I added my Coordinated (long and lalt) but it didnt work. Any Idea?

PWRxPSYCHO commented 6 years ago

Where you able to get your IP location as well? There is a typo with the ip request method as well as in what is returned.

the ip request should be:

ip_json = json.loads(req.text)

NOT ip_json = json.load(req.text)

also the return statement there seems to be an issue:

it should be return ip_json['ip']

NOT return ip_json['text']

if you did not add your own coordinates for the latitude and longitude try that first to rule out the IP issue.

marcoleder commented 6 years ago

Thank you for the idea, I will anwer you asap. I am currently on holidays but in 4 days I will be back and get to try it. Sorry for the wait...

Best Regards

marcoleder commented 6 years ago

I just reinstalled everything, inserted the token and now it works... seems like a bug idk, thanks for all your help tho. !!!