Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

aioredis.exceptions.ResponseError: wrong number of arguments for 'hset' command #1376

Open
1 task done
hongweishang opened this issue Jun 8, 2022 · 1 comment
Open
1 task done
Labels

Comments

@hongweishang
Copy link

Describe the bug

hset function uses HSET command.
when mapping has multi pairs, ResponseError was raised as follow:
aioredis.exceptions.ResponseError: wrong number of arguments for 'hset' command

use HMSET instead?

To Reproduce

loop.run_until_complete(cli.hset('adict', mapping={'a':1, 'b':2}))

Expected behavior

ok

Logs/tracebacks

File "/usr/local/python3/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/root/py3env/lib/python3.8/site-packages/aioredis/client.py", line 1085, in execute_command
    return await self.parse_response(conn, command_name, **options)
  File "/root/py3env/lib/python3.8/site-packages/aioredis/client.py", line 1101, in parse_response
    response = await connection.read_response()
  File "/root/py3env/lib/python3.8/site-packages/aioredis/connection.py", line 919, in read_response
    raise response from None
aioredis.exceptions.ResponseError: wrong number of arguments for 'hset' command

Python Version

$ python --version
3.8

aioredis Version

$ python -m pip show aioredis
2.0.1

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@BabakAmini
Copy link

hmset is deprecated, and you should use hset instead. If you get that error, try to install the latest version of the Redis server. Currently, version 7.0.4 is working for me.

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

No branches or pull requests

2 participants