title: Learning the Python Thread Module
body: <p>I am trying to learn more about the thread module.  I've come up with a quick script but am getting an error when I run it.  The docs show the format as:</p>
  
  <pre><code>thread.start_new_thread ( function, args[, kwargs] )
  </code></pre>
  
  <p>My method only has one argument.</p>
  
  <pre><code>#!/usr/bin/python
  
  import ftplib
  import thread
  
  sites = ["ftp.openbsd.org","ftp.ucsb.edu","ubuntu.osuosl.org"]
  
  def ftpconnect(target):
          ftp = ftplib.FTP(target)
          ftp.login()
          print "File list from: %s" % target
          files = ftp.dir()
          print files
  
  for i in sites:
      thread.start_new_thread(ftpconnect(i))
  </code></pre>
  
  <p>The error I am seeing occurs after one iteration of the for loop:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "./ftpthread.py", line 16,
    in 
        thread.start_new_thread(ftpconnect(i)) TypeError: start_new_thread expected at least 2 arguments, got 1</p>
  </blockquote>
  
  <p>Any suggestions for this learning process would be appreciated.  I also looked into using threading, but I am unable to import threading since its not install apparently and I haven't found any documentation for installing that module yet.</p>
  
  <p>Thank You!</p>
  
  <p>There error I get when trying to import threading on my Mac is:</p>
  
  <pre><code>&gt;&gt;&gt; import threading
  # threading.pyc matches threading.py
  import threading # precompiled from threading.pyc
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "threading.py", line 7, in &lt;module&gt;
      class WorkerThread(threading.Thread) :
  AttributeError: 'module' object has no attribute 'Thread'
  </code></pre>