title: SimpleHTTPServer launched as a thread: does not daemonize
body: <p>I would like to launch a <code>SimpleHTTPServer</code> in a separate thread, while doing something else (here, <code>time.sleep(100)</code>) in the main one. Here is a simplified sample of my code:</p>
  
  <pre><code>from SimpleHTTPServer import SimpleHTTPRequestHandler
  from BaseHTTPServer import HTTPServer
  
  server = HTTPServer(('', 8080), SimpleHTTPRequestHandler)
  print 'OK UNTIL NOW'
  thread = threading.Thread(target = server.serve_forever())
  print 'STUCK HERE'
  thread.setdaemon = True
  try:
      thread.start()
  except KeyboardInterrupt:
      server.shutdown()
      sys.exit(0)
  
  print 'OK'
  
  time.sleep(120)
  </code></pre>
  
  <p>However, the thread remains "blocking", i.e. is not launched as a daemon and the interpreter does not reach the <code>print 'OK'</code>. It does not neither reach the <code>STUCK HERE</code>.</p>
  
  <p>I have though that the thread would only be initialized when calling <code>threading.Thread(...)</code> and that the main thread would still go further until it found the <code>thread.start</code> instruction to launch it.</p>
  
  <p>Is there any better way to accomplish this task?</p>