title: Error handling Python socket - 'socket' object has no attribute 'error'
body: <p>I'm using a try/exception loop to catch socket errors for my server. 
  Yet, I get this error "'socket' object has no attribute 'error'" for this code:</p>
  
  <pre><code>    try: 
          self.socket.bind((self.host, self.port))
          self.socket.listen()
          return self.socket.accept()            
  
      except (self.socket.error, msg):
          print("Couldn't connect to the socket")
          sys.exit(1)
  </code></pre>
  
  <p>Does anyone know how to correctly catch the socket error?</p>