redis-py
redis-py copied to clipboard
can not use NEVER_DECODE on Linux
code
from redis.client import NEVER_DECODE
options = {}
options[NEVER_DECODE] = []
client.execute_command("bgrewriteaof", **options)
error
File "/home/suxiaobin.sxb/gits/tairv4/tests/py_tests/tests/cases/example.py", line 14, in test_example
client.execute_command("info", **options)
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/client.py", line 1218, in execute_command
return conn.retry.call_with_retry(
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/retry.py", line 45, in call_with_retry
return do()
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/client.py", line 1219, in <lambda>
lambda: self._send_command_parse_response(
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/client.py", line 1195, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/client.py", line 1232, in parse_response
response = connection.read_response(disable_decoding=True)
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/connection.py", line 821, in read_response
response = self._parser.read_response(disable_decoding=disable_decoding)
File "/home/suxiaobin.sxb/miniconda3/lib/python3.9/site-packages/redis/connection.py", line 467, in read_response
response = self._reader.gets(False)
TypeError: Reader.gets() takes no arguments (1 given)
version
>>> import redis
>>> redis.__version__
'4.2.2'
python --version
Python 3.9.1
Works fine on MacOS.
@dvora-h this is a real bug. Just updating with the latest error in 4.3.1, since we've merged in async
apthetop: ~ (master)> python -m venv venvforthis
lapthetop: ~ (master)> source venvforthis/bin/activate
(venvforthis) lapthetop: ~ (master)> pip install --no-cache -q redis
(venvforthis) lapthetop: ~ (master)> uname -a
Linux lapthetop 5.17.1-3-MANJARO #1 SMP PREEMPT Thu Mar 31 12:27:24 UTC 2022 x86_64 GNU/Linux
(venvforthis) lapthetop: ~ (master)> python
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> options = {}
>>> options[redis.client.NEVER_DECODE] = []
>>> r = redis.Redis()
>>> r.ping()
True
>>> r.execute_command("bgrewriteaof", **options)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chayim/venvforthis/lib/python3.10/site-packages/redis/client.py", line 1227, in execute_command
return conn.retry.call_with_retry(
File "/home/chayim/venvforthis/lib/python3.10/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/home/chayim/venvforthis/lib/python3.10/site-packages/redis/client.py", line 1228, in <lambda>
lambda: self._send_command_parse_response(
File "/home/chayim/venvforthis/lib/python3.10/site-packages/redis/client.py", line 1204, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File "/home/chayim/venvforthis/lib/python3.10/site-packages/redis/client.py", line 1249, in parse_response
return self.response_callbacks[command_name](response, **options)
TypeError: AbstractRedis.<lambda>() got an unexpected keyword argument 'NEVER_DECODE'
>>>
Fixed in #2302