Skip to content

Legacy reference import error #1063

@drc38

Description

@drc38

Hi, are you able to help with understanding why we get the following import error. It started happening for users when we went to websockets 10.
Many thanks

Error setting up entry central for ocpp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/ocpp/__init__.py", line 28, in async_setup_entry
    central_sys = await CentralSystem.create(hass, entry)
  File "/config/custom_components/ocpp/api.py", line 137, in create
    server = await websockets.serve(
  File "/usr/local/lib/python3.9/site-packages/websockets/imports.py", line 81, in __getattr__
    source = deprecated_aliases[name]
  File "/usr/local/lib/python3.9/site-packages/websockets/imports.py", line 26, in import_name
    assert level < len(source), "importing from parent isn't supported"
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/server.py", line 26, in <module>
    from ..connection import State
  File "/usr/local/lib/python3.9/site-packages/websockets/connection.py", line 17, in <module>
    from .frames import (
ImportError: cannot import name 'OK_CLOSE_CODES' from 'websockets.frames' (/usr/local/lib/python3.9/site-packages/websockets/frames.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions