Well I am not 100% sure (and do not have P3 installed on this machine to test), but in the doco for pickle.dump is:
The file argument must have a write() method that accepts a single bytes argument. It can thus be an on-disk file opened for binary writing
, a io.BytesIO instance, or any other custom object that meets this interface.
Whereas you have opened the file simply for writing, so maybe it needs to be:
file = open('pickle', 'wb')
Have you also tried to just write a simple string and then build to the class?