You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2309, in call
return self.wsgi_app(environ, start_response)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1816, in full_dispatch_request
return self.finalize_request(rv)
File "/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1831, in finalize_request
response = self.make_response(rv)
File "/anaconda3/lib/python3.6/site-packages/flask_api/app.py", line 60, in make_response
rv = self.response_class(rv, headers=headers, status=status)
File "/anaconda3/lib/python3.6/site-packages/flask_api/response.py", line 20, in init
content = renderer.render(content, media_type, **options)
File "/anaconda3/lib/python3.6/site-packages/flask_api/renderers.py", line 61, in render
return json.dumps(data, cls=JSONEncoder, ensure_ascii=False, indent=indent)
File "/anaconda3/lib/python3.6/json/init.py", line 238, in dumps
**kw).encode(obj)
File "/anaconda3/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/anaconda3/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/anaconda3/lib/python3.6/site-packages/flask/json/init.py", line 81, in default
return _json.JSONEncoder.default(self, o)
File "/anaconda3/lib/python3.6/json/encoder.py", line 180, in default
o.class.name)
TypeError: Object of type 'bytes' is not JSON serializable
The text was updated successfully, but these errors were encountered:
Okay, so I managed to resolve this error by add decode_response = true to redis.StrictRedis.from_url function
Here's what I changed
self._r = redis.StrictRedis.from_url(current_app.config['REDIS_URL'])
has been changed to
self._r = redis.StrictRedis.from_url(current_app.config['REDIS_URL'], decode_responses=True)
What I understood from the problem was that redis is sending the response in bytes and it has to be decoded to a relevant form. I am completely new to Redis and Python so please bear with me.
The text was updated successfully, but these errors were encountered: