python - str has no attribute write -


i getting error:

self.write = file.write attributeerror: 'str' object has no attribute 'write' 

what want dump m file-name user has entered in entry...and not whole code please import tkinter etc.

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 not exist") 

error is:

the code posted doesn't cause error does.

regardless, error telling problem is: you're referencing "write" method on string. maybe think you're referencing via open file object actually referencing on string.

without seeing code can't debug further, it's highly you're reusing variable both filename , open file.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -