Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 99] error while attempting to bind on address ('::1', 8484, 0, 0): cannot assign requested address #3

Closed
MatteoGisondi opened this issue Feb 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MatteoGisondi
Copy link

MatteoGisondi commented Feb 7, 2024

Python version(s): 3.10.13 / 3.11.7

mkdocs-live-edit-plugin = "^0.1.4"

...
INFO    -  Documentation built in 21.14 seconds
INFO    -  live-edit websocket server starting
INFO    -  live-edit websocket server thread started
Exception in thread Thread-5 (server_thread_main):
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.13/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/user/.pyenv/versions/3.10.13/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File ".venv/lib/python3.10/site-packages/live/plugin.py", line 221, in server_thread_main
    asyncio.run(self.event_loop())
  File "/home/user/.pyenv/versions/3.10.13/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/user/.pyenv/versions/3.10.13/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File ".venv/lib/python3.10/site-packages/live/plugin.py", line 207, in event_loop
    async with serve(
  File ".venv/lib/python3.10/site-packages/websockets/legacy/server.py", line 1098, in __aenter__
    return await self
  File ".venv/lib/python3.10/site-packages/websockets/legacy/server.py", line 1116, in __await_impl__
    server = await self._create_server()
  File "/home/user/.pyenv/versions/3.10.13/lib/python3.10/asyncio/base_events.py", line 1519, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 99] error while attempting to bind on address ('::1', 8484, 0, 0): cannot assign requested address
INFO    -  [09:28:22] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO    -  [09:28:22] Serving on http://127.0.0.1:8000/

Fix:

/live/plugin.py

async with serve(
        self.websocket_receiver,
        "localhost",
        self.config['websockets_port']
    ):
    ...
async with serve(
        self.websocket_receiver,
        "127.0.0.1",
        self.config['websockets_port']
    ):
    ...

PR coming shortly 😃

@EddyLuten EddyLuten added the bug Something isn't working label Feb 7, 2024
@EddyLuten EddyLuten self-assigned this Feb 7, 2024
@EddyLuten
Copy link
Owner

Thanks for finding and fixing this issue! I've verified the fix locally and everything seems to work right. I'll make sure to include it in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants