Howdy folks, me again. :)
I'm attempting to append to a previously pickled file using cPickle.dump(). But I keep getting the error:
Traceback (most recent call last):
File "C:\Python25\Python\UserAccess.py", line 24, in <module>
TypeError: argument must have 'write' attribute
I've opened the file using the 'a+' attribute, which in my understanding should allow Reading, Writing, and appendage. I would love to know where I'm going wrong here, seeing as I've been bugging Google for an hour now, and the Python Docs only confirm what I thought I knew.
I've only been "trying" to program for around a week now, so if it's something quite obvious, please.... be gentle. :)
#User Access for Password.py import cPickle as p import sys temp = p.load(open('systemaccess.txt', 'a+')) def EP(self): if self.lower() == 'exit': print 'Exiting Program.' sys.exit() print 'Welcome to the System Account Setup.' print 'Enter Exit to end the program at any time.' Username = raw_input('Please enter the username you desire: ') EP(Username.lower()) Password = raw_input('Enter your desired password: ') EP(Password.lower()) if Username.lower() in temp: print 'That username already exists.' else: tempadd = temp tempadd[Username.lower()] = Password.lower() print tempadd #Print to screen for debug. Remove in final revision. p.dump(tempadd, temp) temp.close()