title: socket.gethostname() returning wrong host name
body: <p>When I was setting up my Macbook Pro I changed my hostname I guess to my name <code>Tristan</code>. I'm trying to work with sockets and call:</p>
  
  <pre><code>socket.gethostbyname(socket.gethostname())
  </code></pre>
  
  <p>It is not giving me the error <code>socket.gaierror: [Errno 8] nodename nor servname provided, or not known</code></p>
  
  <p>I'm assuming this is an issue because I have changed the name. If I type:</p>
  
  <pre><code>socket.gethostname('Tristan.local')
  </code></pre>
  
  <p>It actually prints out the correct ip address. My friend's Mac has not had the hostname changed and it returns the address of the network she is on. How do I change my hostname back to the local hostname or whatever I need to do in order to make:</p>
  
  <pre><code>socket.gethostbyname(socket.gethostname())
  </code></pre>
  
  <p>Work again? I thought I was being fun at the time by changing it to my name but now I'm full of regret.</p>