title: Using ftplib for multithread uploads
body: <p>I'm trying to do multithread uploads, but get errors.
  I guessed that maybe it's impossible to use multithreads with ftplib?</p>
  
  <p>Here comes my code:</p>
  
  <pre><code>    class myThread (threading.Thread):
      def __init__(self, threadID, src, counter, image_name):
          self.threadID = threadID
          self.src = src
          self.counter = counter
          self.image_name = image_name
          threading.Thread.__init__(self)
      def run(self):
          uploadFile(self.src, self.image_name)
  
  def uploadFile(src, image_name):
      f = open(src, "rb")            
      ftp.storbinary('STOR ' + image_name, f)
      f.close()
  
  ftp = FTP('host')   # connect to host, default port
  ftp.login()               # user anonymous, passwd anonymous@   
  dirname = "/home/folder/"
  i = 1   
  threads = []
  
  for image in os.listdir(dirname):
      if os.path.isfile(dirname + image):
          thread = myThread(i , dirname + image, i, image )   
          thread.start()
          threads.append( thread )        
          i += 1  
  
  for t in threads:
      t.join()
  </code></pre>
  
  <p>Get bunch of ftplib errors like </p>
  
  <p>raise error_reply, resp
  error_reply: 200 Type set to I</p>
  
  <p>If I try to upload one by one, everything works fine</p>