title: str has no attribute write
body: <p>I am getting this error:</p>
  
  <pre><code>self.write = file.write
  AttributeError: 'str' object has no attribute 'write'
  </code></pre>
  
  <p>What I want to do is dump <code>m</code> into file-name that user has entered in an entry...and this is not the whole code please say to import tkinter etc.</p>
  
  <pre><code>def send(self):
      fl=(t1.get())
      m=(t2.get())       
      x=open("DATABASE.dat",'rb')
      l=pickle.load(x)
      x.close()
      if fl in l:
          box.showinfo("SEND","MESSAGE SEND")
          x=open(fl+".dat","wb")
          pickle.dump(x,m)
          x.close()
  
      else:
          box.showerror("ERROR","USER DOES NOT EXIST")
  </code></pre>
  
  <p>ERROR is:</p>