The data returned by method self.prepSetFile() is of type dictionary
dataTodump=self.prepSetFile()
try:
settingFile=os.path.join(self.settingsDir,"setting.txt")
output_phil=open(settingFile,'w')
pickle.dump(dataTodump,settingFile,0)
except: raise
I do not know why I am getting Attribute error
AttributeError:
‘str’ object has no attribute ‘write’
I even tested the data type of dataTodump which is obviously dict
You need to pass in an open file to
pickle.dump; you are passing in a filename only:Note that the file is opened in binary mode to prevent
\nbytes being translated on non-UNIX platforms.