Reputation: 7161
I am using Spyder Python IDE, Python version 3.5 and trying to run this python file having code
import pickle
enron_data = pickle.load(open("../final_project/final_project_dataset.pkl", "r"))
However on running, it throws following error
TypeError: a bytes-like object is required, not 'str'
Upvotes: 1
Views: 1732
Reputation: 46901
you need to open your file in binary (so read
it returns bytes
and not str
):
open("../final_project/final_project_dataset.pkl", "rb")
(note the additional 'b'
in the mode).
Upvotes: 3