ZADD throws error with dict
See original GitHub issueWhile trying to add elements to a zset, I get the following error stacktrace
Traceback (most recent call last):
File "test.py", line 6, in <module>
r.zadd("KEY", kwargs=dict)
File "/Library/Python/2.7/site-packages/redis/client.py", line 2057, in zadd
return self.execute_command('ZADD', name, *pieces)
File "/Library/Python/2.7/site-packages/redis/client.py", line 573, in execute_command
return self.parse_response(connection, command_name, **options)
File "/Library/Python/2.7/site-packages/redis/client.py", line 585, in parse_response
response = connection.read_response()
File "/Library/Python/2.7/site-packages/redis/connection.py", line 582, in read_response
raise response
redis.exceptions.ResponseError: value is not a valid float
The code I was trying to run was
import redis
r = redis.Redis(host='localhost', port=6379, db=2)
dict = {'akarshit': 1.1}
r.zadd("KEY", kwargs=dict)
Is there something I am missing or is this a bug with py-redis?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
ZADD throws error with dict · Issue #771 · redis/redis-py - GitHub
I understand that the cause of error is that the zadd() expects a argument name= and while unpacking the dictionary the name from...
Read more >not able to insert data using ZADD(sorted set ) in redis using ...
Instead of args/kwargs, a dict is expected, with key as data and value is the ZADD score. There are no changes in retrieving...
Read more >Python Dict and File | Python Education - Google Developers
Looking up a value which is not in the dict throws a KeyError -- use "in" to check if the key is in...
Read more >You're Probably Thinking About Redis Streams Wrong
Redis Head of Developer Advocacy Kyle Davis explains how you can leverage Redis Streams' less-understood properties in your applications.
Read more >ZADD - Redis
If the key exists but does not hold a sorted set, an error is returned. The score values should be the string representation...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It should be:
@andymccurdy hi… is the issue of
redis.exceptions.RedisError: ZADD requires an equal number of values and scoreswhen adding dict object, still open? I’m using redis version 3.0.6 connected using redis-python