Description
Version: What redis-py and what redis version is the issue happening on?
redis==4.3.0
Platform: What platform / version?
python 3.8 on MacBook Pro (13-inch, M1, 2020)
Description: Description of your issue, stack traces from errors and code that reproduces the issue
Hello I am facing an issue when I am playing with the RedisCluster
class which is in redis.asyncio (not the regular RedisCluster one).
For creating my connection, I just created a very simple one -
self.redis = redis.RedisCluster(host=self.url, encoding='utf-8')
In my project, the first get
func to my redis always errors out with AttributeError: 'NoneType' object has no attribute 'execute_command'
, and then if I hit my service a second call, my service will be working fine..
It seems like the initialize
function in parser.py
gets a None
in the r
value. Not sure if I missed any required arguments to avoid this error or it's a bug. Can someone plz help? Thanks!
Here's my Traceback logs:
[2023-01-11 17:40:21] [ERROR] Traceback (most recent call last):
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/parser.py", line 52, in get_keys
command = self.commands[args[0]]
KeyError: 'GET'
During handling of the above exception, another exception occurred:
....
File "/Users/.../redis.py", line 43, in get
res = await self.redis.get(name=key)
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/cluster.py", line 618, in execute_command
raise e
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/cluster.py", line 580, in execute_command
target_nodes = await self._determine_nodes(
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/cluster.py", line 460, in _determine_nodes
await self._determine_slot(*args),
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/cluster.py", line 491, in _determine_slot
keys = await self.commands_parser.get_keys(
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/parser.py", line 61, in get_keys
await self.initialize(redis_conn)
File "/Users/.../lib/python3.8/site-packages/redis/asyncio/parser.py", line 31, in initialize
commands = await r.execute_command("COMMAND")
AttributeError: 'NoneType' object has no attribute 'execute_command'