I faced this error when I try to open a pickle file. Initially I try to open with 'r' method it throws me the error. then I try to open with 'rb' method, my file opens and my code executes