redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.12k stars 112 forks source link

TypeError: 'NoneType' object is not subscriptable #378

Closed javadKefayati closed 2 years ago

javadKefayati commented 2 years ago

hello every one

when I try to run this code :

import datetime from typing import Optional from redis_om import ( Field, HashModel, Migrator )

class Customer(HashModel): ---first_name: str ---last_name: str = Field(index=True) ---join_date: datetime.date ---age: int = Field(index=True) ---bio: Optional[str]

Migrator().run() Customer.find(Customer.last_name == "Brookins").all()

Suddenly I encounter an error:

Traceback (most recent call last): File "/home/javad/files/github/cash_book/django_cache/store/model_redis.py", line 30, in <module> Customer.find(Customer.last_name == "Brookins").all() File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis_om/model/model.py", line 1177, in find return FindQuery(expressions=expressions, model=cls) File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis_om/model/model.py", line 347, in __init__ if not has_redisearch(model.db()): File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis_om/checks.py", line 25, in has_redisearch if has_redis_json(conn): File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis_om/checks.py", line 17, in has_redis_json command_exists = check_for_command(conn, "json.set") File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis_om/checks.py", line 9, in check_for_command cmd_info = conn.execute_command("command", "info", cmd) File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/client.py", line 1238, in execute_command return conn.retry.call_with_retry( File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/retry.py", line 46, in call_with_retry return do() File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/client.py", line 1239, in <lambda> lambda: self._send_command_parse_response( File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/client.py", line 1215, in _send_command_parse_response return self.parse_response(conn, command_name, **options) File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/client.py", line 1260, in parse_response return self.response_callbacks[command_name](response, **options) File "/home/javad/files/github/cash_book/env/lib/python3.10/site-packages/redis/client.py", line 550, in parse_command cmd_name = str_if_bytes(command[0]) TypeError: 'NoneType' object is not subscriptable

TypeError: 'NoneType' object is not subscriptable

Can anyone help why?

javadKefayati commented 2 years ago

.

ThomasJRyan commented 2 years ago

Hi @javadKefayati

Did you figure out why this error was happening?

Edit: This issue explains it https://github.com/redis/redis-om-python/issues/146