Blink with cheerlights.py

I’m running the cheerlights.py program om blinkt, it’s works for a while then stops working I restart it and works sometime for 20 or so hours then quits again. I ran it with nohup and get this error:

Traceback (most recent call last):
File “cheerlights.py”, line 16, in
col = r.json()[‘field2’]
File “/usr/lib/python2.7/dist-packages/requests/models.py”, line 793, in json
return json.loads(self.text, **kwargs)
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

I’m not a programmer how i make python ignore this and keep it running?

I believe this user’s pull request to our github aims to address exactly this issue?

Putting the timeout in made it faster than before so not the answer to my
problem. Error I got with the timeout=2:

Traceback (most recent call last):
File “cheerlights.py”, line 14, in
r = requests.get(‘
http://api.thingspeak.com/channels/1417/field/2/last.json’, timeout=2)
File “/usr/lib/python2.7/dist-packages/requests/api.py”, line 60, in get
return request(‘get’, url, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/api.py”, line 49, in
request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/sessions.py”, line 457,
in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python2.7/dist-packages/requests/sessions.py”, line 569,
in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/dist-packages/requests/adapters.py”, line 422,
in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host=‘api.thingspeak.com’,
port=80): Read timed out. (read timeout=2)