New submission from Sorin Sbarnea <sorin.sbar...@gmail.com>:
It seems that when the MacOS machine does not have a FQDN name manually configured using `scutil`, python will be fail to resolve domain names and timeout after ~30 seconds. I mention that the DNS resolution works correctly on the machine and that the DHCP servers provides one ore more domains to be useles for resolution. Tools like nslookup or ping are not affected by this, only python (tried py27,34-36 and got same behavior). Usually python user encounters errors like: Traceback (most recent call last): ... socket.gethostbyname(socket.gethostname()) gaierror: [Errno 8] nodename nor servname provided, or not known One these machines `hostname` cli command returns a valid FQDN name like `foo.lan` but scutil will not return one: ``` sudo scutil --get HostName HostName: not set ``` One temporary workaround is to manually run: ``` sudo scutil --set HostName `hostname` ``` This will set the hostname and python sockets functions will start to work (after few minutes as some caching is involved). Still, we cannot expect users to run this command themselves. Even worse, they would have to re-run this each time the roam to another network that may have a different set of domains. See: https://stackoverflow.com/questions/52602107 ---------- components: macOS messages: 329237 nosy: ned.deily, ronaldoussoren, ssbarnea priority: normal severity: normal status: open title: socket.getfqdn and socket.gethostbyname fail on MacOS type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35164> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com