I have a large object in my Python3 code which, when tried to be pickled with the pickle module throws the following error:
TypeError: cannot serialize '_io.BufferedReader' object
However, dill.dump() and dill.load() are able to save and restore the object seamlessly.
- What causes the trouble for the
picklemodule? - Now that
dillsaves and reconstructs the object without any error, is there any way to verify if the pickling and unpickling withdillwent well? - How's it possible that
picklefails, butdillsucceeds?