title: python thread cannot create more than 800
body: <p>below is my code and im really new to python. from my below code, i will actually create multiple threads (above 1000). but at some point, nearly 800 threads, i get an error message saying "error:cannot start new thread". i did read some about threadpool. i couldnt really understand. in my code, how can i implement threadpool? or at least please explain to me in a simple way</p>
  
  <pre><code>    #!/usr/bin/python
  
  
      import threading
      import urllib
  
      lock = threading.Lock()
  
      def get_wip_info(query_str):
            try:
                temp = urllib.urlopen(query_str).read()
            except:
                temp = 'ERROR'
            return temp
  
      def makeURLcall(arg1, arg2, arg3, file_output, dowhat,        result) :
  
           url1 = "some URL call with args"
           url2 = "some URL call with args"
  
          if dowhat == "IN" :
               result = get_wip_info(url1)
  
          elif dowhat == "OUT" :
               result = get_wip_info(url2)
  
          lock.acquire()
  
          report = open(file_output, "a")
          report.writelines("%s - %s\n"%(serial, result))
          report.close()
  
          lock.release()
  
          return
  
  
      testername = "arg1"
      stationcode = "arg2"
      dowhat = "OUT"
      result = "PASS"
      file_source = "sourcefile.txt"
      file_output = "resultfile.txt"
  
      readfile = open(file_source, "r")
      Data = readfile.readlines()
  
      threads = []
  
      for SNs in Data :
          SNs = SNs.strip()
          print SNs
          thread = threading.Thread(target = makeURLcalls, args = (SNs, args1, testername, file_output, dowhat, result))
          thread.start()
  
          threads.append(thread)
  
      for thread in threads :
          thread.join()
  </code></pre>