Closed
Description
Version:
redis-py: 4.3.4
Redis: 7.0.5
Platform:
Python 3.9.15 (main, Oct 11 2022, 21:39:54)
[Clang 14.0.0 (clang-1400.0.29.102)] on darwin
MacOS
Description:
Passing 0.0 longitude or latitude to geosearch results in:
redis.exceptions.ResponseError: wrong number of arguments for 'geosearch' command
def main():
redis = Redis.from_url(url="redis://localhost:6379")
key = "theindex"
lon: float = 0.0
lat: float = 1.0
redis.geoadd(name=key, values=[lon, lat, "foo"])
results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km")
print(results)
Stack trace:
poetry run python playground/bug/main.py
Traceback (most recent call last):
File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 22, in <module>
main()
File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 18, in main
results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km")
File "/.../python3.9/site-packages/redis/commands/core.py", line 5474, in geosearch
return self._geosearchgeneric(
File "/.../python3.9/site-packages/redis/commands/core.py", line 5605, in _geosearchgeneric
return self.execute_command(command, *pieces, **kwargs)
File "/.../python3.9/site-packages/redis/client.py", line 1238, in execute_command
return conn.retry.call_with_retry(
File "/.../python3.9/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/.../python3.9/site-packages/redis/client.py", line 1239, in <lambda>
lambda: self._send_command_parse_response(
File "/.../python3.9/site-packages/redis/client.py", line 1215, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File "/.../python3.9/site-packages/redis/client.py", line 1254, in parse_response
response = connection.read_response()
File "/.../python3.9/site-packages/redis/connection.py", line 839, in read_response
raise response
redis.exceptions.ResponseError: wrong number of arguments for 'geosearch' command