gaierror: [Errno 8] nodename nor servname provided, or not known (with macOS Sierra) : <p>socket.gethostbyname(socket.gethostname()) worked well on OS X El Capitan. However, it's not working now after the Mac updated to macOS Sierra.</p>

<p>Thanks!</p>

<pre><code>import socket
socket.gethostbyname(socket.gethostname())

Traceback (most recent call last):
  File "&lt;pyshell#26&gt;", line 1, in &lt;module&gt;
    socket.gethostbyname(socket.gethostname())
gaierror: [Errno 8] nodename nor servname provided, or not known
</code></pre>
