I have a method that opens a file, lock it, pickle.load the file into a dictionary.I then modify the status of a record, then pickle.dump the dictionary back to the file.
The problem is that the pickle.dump never works. The file never gets updated.
def updateStatus(self, fp, stn, status):
f = open(fp, rw+)
fcntl.flock(f.fileno(),fcntl.LOCK_EX | fcntl.LOCK_NB)
tb = pickle.load(f)
self.modifyDict(tb, stn, status)
What could be the problem here?What mode should I use to open the file to allow both pickle.load and pickle.dump?