Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Exception on Data types #157

Open
mjibril opened this issue Jan 26, 2020 · 4 comments
Open

Redis Exception on Data types #157

mjibril opened this issue Jan 26, 2020 · 4 comments

Comments

@mjibril
Copy link

mjibril commented Jan 26, 2020

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 that ring.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

@youknowone
Copy link
Owner

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?

@mjibril
Copy link
Author

mjibril commented Jan 26, 2020

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

@youknowone
Copy link
Owner

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?

@mjibril
Copy link
Author

mjibril commented Feb 13, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants