Open mjibril opened 4 years ago
It sounds like a bug. every input/output is intended to be converted to bytes.
do you have small reproducible code example about this bug?
import ring
import redis
redis_client=redis.Redis()
@ring.redis(redis_client,key_prefix="api")
def long_running(arg1,arg2):
return arg1
long_running([1,2],1);
I am using redis==3.3.11
and ring==0.7.3
.... and python 3.7.4
I tried the same code but didn't find any problem.
$ pip freeze | grep redis
redis==3.3.11
$ python --version
Python 3.7.0
python version is slightly different
$ python issue157.py
b'[1, 2]'
Any idea what can be different from yours and mine?
So I checked again and the following exception is raised first,
Traceback (most recent call last): File "/.../virtual/lib/python3.7/site-packages/ring/func/sync.py", line 48, in get_or_update result = self.rope.storage.get(key) File "/.../virtual/lib/python3.7/site-packages/ring/func/base.py", line 793, in get value = self.get_value(key) File "/.../virtual/lib/python3.7/site-packages/ring/func/sync.py", line 327, in get_value raise fbase.NotFound ring.func.base.NotFound
I keep getting,
redis.exceptions.DataError: Invalid input of type: 'list'. Convert to a byte, string or number first
on a function
@ring.redis(redis_client,key_prefix="api")
def find(self,source,destination):
where
source
is a python list of integers.@ring.lru
works fine though. Could it be thatring.redis
is not converting function arguments or return values to data types acceptable to redis?The exception is raised in
redis/connection.py", line 118, in encode