Skip to content

[Library Bug] NameError: name 'Client' is not defined #188

@thex1le

Description

@thex1le

Describe the bug
attempting to import home assistant returns the following trace back..

`Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from homeassistant_api import Client
Traceback (most recent call last):
File "", line 1, in
File "/home/textile/HomeAssistantAPI/homeassistant_api/init.py", line 26, in
from .client import Client
File "/home/textile/HomeAssistantAPI/homeassistant_api/client.py", line 5, in
from .rawasyncclient import RawAsyncClient
File "/home/textile/HomeAssistantAPI/homeassistant_api/rawasyncclient.py", line 26, in
from .models import Domain, Entity, Event, Group, History, LogbookEntry, State
File "/home/textile/HomeAssistantAPI/homeassistant_api/models/init.py", line 3, in
from .domains import Domain, Service, ServiceField
File "/home/textile/HomeAssistantAPI/homeassistant_api/models/domains.py", line 15, in
class Domain(BaseModel):
File "/home/textile/.local/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 114, in new
private_attributes = inspect_namespace(
^^^^^^^^^^^^^^^^^^
File "/home/textile/.local/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 448, in inspect_namespace
ann_type = eval_type_backport(
^^^^^^^^^^^^^^^^^^^
File "/home/textile/.local/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 279, in eval_type_backport
return _eval_type_backport(value, globalns, localns, type_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/textile/.local/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 303, in _eval_type_backport
return _eval_type(value, globalns, localns, type_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/textile/.local/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 332, in _eval_type
return typing._eval_type( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/typing.py", line 359, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/typing.py", line 857, in _evaluate
eval(self.forward_code, globalns, localns),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1, in
NameError: name 'Client' is not defined`

To Reproduce
Steps to reproduce the behavior:

  1. Download latest code from github or install from pip3 on raspberry pi OS bookworm. In my case I am using a pi5 but i tested and it also happens on bookworm on a pi4. Both codebases have the issue

  2. Attempt to import home assistant api client in python3.11.2
    from homeassistant_api import Client

  3. Receive Traceback

Expected behavior
A clean import of the object to use

Desktop (please complete the following information):

  • OS: RaspberryPi OS Bookworm
  • OS Bookworm
  • HomeAssistantAPI Version: 4.2.2 but I also got the same bug on the dev branch pulling from git

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions