Skip to content

Reopen "Circular interface reference causes ImportError" #73 #81

@nameOfUser0236

Description

@nameOfUser0236

#73
This issue still exists as of version 0.4.18

steps to reproduce:

  • install pywayland
    • python -m venv venv
    • source venv/bin/activate
    • pip install pywayland
  • copy extension protocol of your choice to project folder (ext-workspace-v1 used as an example)
  • python -m pywayland.scanner -i ./ext-workspace-v1.xml /usr/share/wayland/wayland.xml
  • open python
    • >>> import pywayland.protocol.ext_workspace_v1
  • see error
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import pywayland.protocol.ext_workspace_v1
  File "/tmp/wayland/venv/lib/python3.14/site-packages/pywayland/protocol/ext_workspace_v1/__init__.py", line 28, in <module>
    from .ext_workspace_group_handle_v1 import ExtWorkspaceGroupHandleV1  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/wayland/venv/lib/python3.14/site-packages/pywayland/protocol/ext_workspace_v1/ext_workspace_group_handle_v1.py", line 42, in <module>
    from .ext_workspace_handle_v1 import ExtWorkspaceHandleV1
  File "/tmp/wayland/venv/lib/python3.14/site-packages/pywayland/protocol/ext_workspace_v1/ext_workspace_handle_v1.py", line 41, in <module>
    from .ext_workspace_group_handle_v1 import ExtWorkspaceGroupHandleV1
ImportError: cannot import name 'ExtWorkspaceGroupHandleV1' from partially initialized module 'pywayland.protocol.ext_workspace_v1.ext_workspace_group_handle_v1' (most likely due to a circular import) (/tmp/wayland/venv/lib/python3.14/site-packages/pywayland/protocol/ext_workspace_v1/ext_workspace_group_handle_v1.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions