title: TypeError: __init__() takes exactly 2 arguments (1 given)
body: <p>I don't understand why I'm getting the following error and would appreciate some advice.  Thanks.</p>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 5, in &lt;module&gt;
      ciphertext = md.encrypt(plaintext)
    File "/Volumes/Mac/Computer/Programming/Cryptography/crypto.py", line 87, in encrypt
      ciphertext = Text()
  TypeError: __init__() takes exactly 2 arguments (1 given)
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import crypto
  
  plaintext = crypto.Text('plaintext.txt')
  md = crypto.MonomeDinome('fred', 'wilma')
  ciphertext = md.encrypt(plaintext)
  print ciphertext
  </code></pre>
  
  <p>Crypto.py has the following code:</p>
  
  <pre><code>class Text:
      def __init__(self, filename):
          self.load(filename)
  
      def load(self, filename):
          fp = open(filename, "r")
          self.rawtext = fp.read()
          fp.close
          self.text = self.convert(self.rawtext)
  
      def convert(self, txt):
          rval = ""
          for c in txt.upper():
              if c.isalpha():
                  rval += c
          return rval
  
      def set(self, lst):
          self.text = "".join(lst)
  
      def get(self):
          return self.text
  
      def __str__(self):
          rval = ""
          pos = 0
          for c in self.text:
              rval += c
              pos += 1
              if pos % 60 == 0:
                  rval += '\n'
              elif pos % 5 == 0:
                  rval += " "
          return rval
  
  class MonomeDinome:
      def __init__(self, dkw, lkw):
          self.digitsKey = self.digitsScramble(dkw)
          self.lettersKey = self.lettersScramble(lkw)
  
      def digitsScramble(self, dkw):
          dkl = list((dkw.upper() + "ZZZZZZZZZZ")[0:10])
  
          for i in "0123456789":
              pos = self.findLowestLetter(dkl)
              if pos != -1:
                  dkl[pos] = i
  
          return "".join(dkl)
  
      def findLowestLetter(self, lst):
          pos = -1
          lowest = ''
  
          for i in range(len(lst)):
              if lst[i].isalpha():
                  if (lowest == '') or (lst[i] &lt; lowest):
                      lowest = lst[i]
                      pos = i
          return pos
  
      def lettersScramble(self, lkw):
          rlist = []
          for a in lkw.upper():
              if a == "W":
                  a = "V"
              if a == "J":
                  a = "I"
              if not a in rlist:
                  rlist.append(a)
  
          for a in "ABCDEFGHIKLMNOPQRSTUVXYZ":
              if not a in rlist:
                  rlist.append(a)
  
          return "".join(rlist)
  
      def __str__(self):
          return "digitsKey = " + self.digitsKey + "\n" + \
                  "lettersKey = " + self.lettersKey
  
      def encrypt(self, plaintext):
          rlist = []
          for char in plaintext.get():
              rlist.append(char)
          ciphertext = Text()
          ciphertext.set(rlist)
          return ciphertext
  </code></pre>