-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
run on macos report socket.gaierror: [Errno 8] nodename nor servname provided, or not known #1178
Comments
Strange. We mostly develop on MacOS and have not encountered this error. Could you try another port like suggested in #1154? |
i try change port ui.run(port=5500) or ui.run(port=9900) or ui.run(port=8989) . It still report socket.gaierror: [Errno 8] nodename nor servname provided, or not known. the error is
i test socket.gethostname() the result is 'ddim.local', ddim is my username. socket.getaddrinfo(socket.gethostname(), None) is report error. my python verison is 3.11.4. |
my macos version is 13.4.1(c) |
Ah your error output probably helped. You can simply fix the issue with import socket
socket.getaddrinfo(socket.gethostname(), None) in an interactive Python shell? |
i installed netifaces use python -m pip install netifaces.
|
if add '127.0.0.1 [hostname]' in /etc/hosts, hostname is the result of socket.gethostname() import socket
socket.getaddrinfo(socket.gethostname(), None) it run correctly |
I had the same proble as you
|
Thank you. |
Thanks for the workaround @Devil-Ryu! Hardcoding the host IP as loopback works but is inconvenient. Guessing the error handling is off somehow. If it's OS-specific, I've used import platform
if platform.system() == 'Darwin':
host = host or '127.0.0.1'
elif platform.system() == 'Linux':
host = host or '127.0.0.1'
elif platform.system() == 'Windows':
host = host or '127.0.0.1'
else:
host = host or '0.0.0.0'
if fullscreen:
native = True
if frameless:
native = True
if window_size:
native = True
if native:
show = False
# host = host or '127.0.0.1'
port = native_mode.find_open_port()
width, height = window_size or (800, 600)
native_mode.activate(host, port, title, width, height, fullscreen, frameless)
# else:
# host = host or '0.0.0.0' Could have implications for running in a docker container ( System InfomacOS 12.6.7 (21G651) |
Using only |
It seems like this known macos issue: My understanding is that if you don't enable any sort of filesharing |
That's what it already is. Only difference is now there's a platform check to make sure it's enforced. The
I can ping my localhost just fine. Enabling file sharing to get a website working is not a tenable solution. Looks like editing
|
FWIW hardcoding the hostname in # 127.0.0.1 mbp
[(<AddressFamily.AF_INET: 2>,
<SocketKind.SOCK_DGRAM: 2>,
17,
'',
('127.0.0.1', 0)),
(<AddressFamily.AF_INET: 2>,
<SocketKind.SOCK_STREAM: 1>,
6,
'',
('127.0.0.1', 0))]
# 127.0.0.1 localhost
gaierror Traceback (most recent call last)
Cell In [2], line 1
----> 1 socket.getaddrinfo(socket.gethostname(), None)
File ~/.asdf/installs/python/3.11.4/lib/python3.11/socket.py:962, in getaddrinfo(host, port, family, type, proto, flags)
959 # We override this function since we want to translate the numeric family
960 # and socket type values to enum constants.
961 addrlist = []
--> 962 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
963 af, socktype, proto, canonname, sa = res
964 addrlist.append((_intenum_converter(af, AddressFamily),
965 _intenum_converter(socktype, SocketKind),
966 proto, canonname, sa))
gaierror: [Errno 8] nodename nor servname provided, or not known |
Ah by deactivating all sharing features in the macOS settings, restarting the laptop and deinstalling netifaces I can reproduce the original |
Description
when i run examples on macos, it fails, report socket.gaierror: [Errno 8] nodename nor servname provided, or not known. i use version is 1.3.3
The text was updated successfully, but these errors were encountered: