Apologies if this is already answered elsewhere. I have looked around the internet and didn't find a clear answer
I have a class definition (that contains several values and methods), and multiple instantiations of the class held in a list. (Each list entry is an instantiation.)
When I try to pickle the list I get a "pickle.PicklingError" exception. This led me to learn that some objects are not 'pickleable', but it seems like my simple list should be OK.
Which objects are unpickleable?
Here is the actual code doing the pickling. (this code is a method defined inside of a class which also contains the class objects I need to pickle. Is this part of the problem?)
def Write_Transaction_History_To_File(self):
if (self.Transaction_History == True): # if History is not empty
filename = self.Transaction_Name + '_Transaction_History.bin'
f = open(filename, 'w')
try:
pickle.dump(self.Transaction_History , f, -1) #use highest protocol
except pickle.PicklingError:
print 'Error when serializing data'
f.close()
else:
print 'No History to store'