title: Python socket server failing
body: <p>I'm trying to start a UDP server in python 3.</p>
  
  <p>I copied the code from <a href="https://docs.python.org/3/library/socketserver.html?highlight=sockets#socketserver-udpserver-example" rel="nofollow noreferrer">this example.</a></p>
  
  <p>This is my exact code.</p>
  
  <pre><code>import socketserver
  
  class MyUDPHandler(socketserver.BaseRequestHandler):
      """
      This class works similar to the TCP handler class, except that
      self.request consists of a pair of data and client socket, and since
      there is no connection the client address must be given explicitly
      when sending data back via sendto().
      """
  
      def handle(self):
          data = self.request[0].strip()
          socket = self.request[1]
          print("{} wrote:".format(self.client_address[0]))
          print(data)
  
  if __name__ == "__main__":
      HOST, PORT = "localhost", 19446
      with socketserver.UDPServer((HOST, PORT), MyUDPHandler) as server:
          server.serve_forever()
  </code></pre>
  
  <p>I have only removed the reply from the handle method and changed the port number.</p>
  
  <p>when i try to run it i get this</p>
  
  <pre><code>$ sudo python3 test.py
    File "test.py", line 19, in &lt;module&gt;
      with socketserver.UDPServer((HOST, PORT), MyUDPHandler) as server:
  AttributeError: __exit__
  </code></pre>
  
  <p>I am attempting to run this in Python 3.4.2 installed on a Raspberry Pi 3, it was working this morning.
  I googled <code>AttributeError: __exit__</code> and found that <code>with</code> uses built in methods such as <code>__exit__</code> to gracefully close after it has finished running instructions indented after it.</p>
  
  <p>The exact same code runs fine on my windows machine (Python 3.6.2) and the code used to run on my raspberry pi and the only thing i have done with it all day was install x11vnc server and plugged in a lot of USB devices. (A capture card and arduinos, no usb drives from untrusted sources).</p>
  
  <p>So <strong>my question is</strong>, what can cause an <code>Attribute Error: __exit__</code> in the <code>socketserver</code> library.</p>