title: How to fix 'TypeError using Threads' in Python
body: <p>My first ZipCracker worked but it just checked Passwords which are in the range from 0 to 2000. I wanted that my ZipCracker could check every Combination and programmed it with Threads, now it doesn't work.</p>
  
  <p>I learn the programming language Python at this time. I want to practice it a little bit. I decided to program a little ZipCracker.</p>
  
  <pre><code># -*- coding: UTF-8 -*-
  from threading import Thread
  import zipfile
  import string
  import itertools
  
  class ZipCracker():
  
          def __init__(self, filename): 
          self.filename = filename
          self.zipfile = zipfile.ZipFile(filename)
          self.targetdirectory = filename[:-4]
  
      def test_password(self, password):
          try:
              self.zipfile.extractall(path=self.targetdirectory, pwd =  str.encode(password))
              return True
          except Exception as e:
              return False
  
      def brute_force(self):
  
          zipFile = self.targetdirectory
          myLetters = string.ascii_letters + string.digits + string.punctuation
          for i in range(3, 10):
              for j in map(''.join, itertools.product(myLetters, repeat=i)):
                  t = Thread(target=ZipCracker.test_password, args=(zipFile, j,))
                  password = str(j)
                  print password
                  t.start()
  
              if self.ZipCracker.test_password(password):
                  print("Erfolg: " + password)
                  return password
  
          return None
  </code></pre>
  
  <p>I expect that the output is that every possibility should be showed and it should stop when the right password is there, but the actual output is the following Error:</p>
  
  <pre><code>Exception in thread Thread-6152:
  Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
      self.run()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
      self.__target(*self.__args, **self.__kwargs)
  TypeError: unbound method test_password() must be called with ZipCracker instance as first argument (got str instance instead)
  </code></pre>