5

I have a sorted set in Redis. I am trying to update the counter value of a specific element by using zincrby in Python code like:

conn.zincrby("usersSet", float(1), "user1")

But it is showing an error as : 'Error: value is not a valid float'

I tried the same command on cli : zincrby usersSet 1 users1 And it is working correctly. Is there any other method in Python code to increase the counter value of the specific key in the sorted set.

1 Answer 1

9

Parameters order are differ between redis-cli and python connector. You have to write conn.zincrby("usersSet", "user1", 1)

UPDATE

The python redis library was updated to match redis-cli's order of arguments.

Hence, conn.zincrby("usersSet", 1, "user1") will be the correct usage now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.