title: AttributeError: 'set' object has no attribute 'items'
body: <p>I am very new to python and have been trying to teach myself as I go (not the best method this deep into python but for time's sake I need too). The modules I've imported are Tkinter and csv. Let me know if you have any questions,</p>
  
  <p>For the sake of brevity I am not going to post my entire code on here but I will include the entire error and indicate the line that the error is applying to. Everything that is below is in a class called MainApp.</p>
  
  <pre><code>def SubmitEdit(self):
      self.key=""
      self.val=""
      new_rows = []
      self.changes = {self.key:self.val}
      with open("info.csv",'rb') as f:
          reader = csv.reader(f):
          for row in reader:
              new_row = row
              for field in row:
                  if field == "NAME":
                      print "groovy"
              for (self.key,self.val) in self.changes.items():
                  new_row = [ x.replace(self.key,self.val) for x in new_row]
              new_rows.append(new_row)
       with open("info.csv","wb") as f:
           writer = csv.writer(f):
           writer.writerows(new_rows)
  </code></pre>
  
  <p>I wrote this code out separately to make sure it worked before putting it in the program and it worked perfectly, but when I put it in the class and made the changes (I thought) I needed to make to the lines of code / variables it didn't work. So that leads me to believe that I'm just correcting something incorrectly.</p>
  
  <p>Here is the error:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
      File "C:\Python27\lib\lib-tk\Tkinter.py",line 1536, in__call__
          return self.func(*args)
      File "C:\Python27\draft.py", line 328, in SubmitEdit
          for (self.key,self,val) in self.changes:
  AttributeError: 'set' object has no attribute 'items'
  </code></pre>
  
  <p>Where line 328 refers to the line:
  "or (self.key,self.val) in self.changes.items():"</p>
  
  <p>I have changed around (I feel like) the presence or absence of "self." for all variables but I just can't get it to work.</p>
  
  <p>EDIT:
  I altered the code to look like this:</p>
  
  <pre><code>def SubmitEdit(self):
      new_rows = []
      self.changes = {"MTMA",123}
      with open("info.csv",'rb') as f:
          reader = csv.reader(f):
          for row in reader:
              new_row = row
              for field in row:
                  if field == "NAME":
                      print "groovy"
              for (key,val) in self.changes.items():
                  new_row = [ x.replace(key,val) for x in new_row]
              new_rows.append(new_row)
       with open("info.csv","wb") as f:
           writer = csv.writer(f):
           writer.writerows(new_rows)
  </code></pre>
  
  <p>as per the comments, but still get the exact same error.</p>